Jump to content

pull all the data


RON_ron

Recommended Posts

I need to pull all the mysql data by the order of it's date/time . How can I write the code?

 

I'm using this as a serverside script and I'm not a php person. But i believe the below code will not pull the data. Will it work if I remove the text marked in red?

 

$query = "SELECT * FROM  sub_db WHERE the_code = '".$abc."'" ORDER BY timestampz ASC";

Link to comment
https://forums.phpfreaks.com/topic/210301-pull-all-the-data/
Share on other sites

How can I put 2 queries using the same php script? (ie. the same values to be sent to database 1 and 2)

 

 

$query = "INSERT INTO db_1(abc1, abc2, abc3, abc4) VALUES('$a','$b','$c,'$d')";
$query = "INSERT INTO db_2(abc1, abc2, abc3, abc4) VALUES('$a','$b','$c,'$d')";

$result = mysql_query($query);
$sentOk = "The data has been added to the database.";

Link to comment
https://forums.phpfreaks.com/topic/210301-pull-all-the-data/#findComment-1097454
Share on other sites

With your code all you're doing is storing the first query within $query, then overwriting the same variable with the next query and then running that. You can't be trying to debug this much yourself as a quick var_dump() test on $query before you try to execute it, would have shown you that you only have the second query stored.

 

How can I put 2 queries using the same php script? (ie. the same values to be sent to database 1 and 2)

Do you mean insert the same values into both tables? Different databases would require a very different approach. A good question is why do you want to store identical data within two identical tables? Seems a little redundant to me.

Link to comment
https://forums.phpfreaks.com/topic/210301-pull-all-the-data/#findComment-1097482
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.