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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.