Hi
Can anyone tell me if its possible to combine a php variable & an sql statement
I have a standard SQl selct statement such as "Select * from table"
the following lines of code then results in a php variable such as
$totalnumber_rows table blah blah
how can I select the primary key from a table that corresponds to the row number returned above.
cheers folks
Tim
PHP Variable in mySQl Statement
Moderator: General Moderators
Unless I'm simply not understanding you, your SQL statement needs to be altered a bit, e.g.
The `ID` field mentioned is your PRIMARY KEY.
Is that what you're looking for?
Code: Select all
SELECT column1, column2 FROM table WHERE ID= {PHP_VARIABLE}Is that what you're looking for?
PHP Variable in mySQl Statement
Thats almost what I'm aiming at,
based in what u said I have now got my SQL statement as follows
cheers again
Tim
based in what u said I have now got my SQL statement as follows
Code: Select all
$query_rstruehighestID = "select itineraryID From itinerary where rownumber ="{$totalRows_rshighestID}Tim