PHP - How To Retrive This Sql On Php
So I would like to write a query on PHP but it doesnt exactly work the way I want it to work
Code: [Select] Select * FROM user WHERE Rol_ID = 1 When I run this query it work on my sql, but when I try to enter this on a php page it just wont work. Similar Tutorialshi this is my code but I can't see the array in echo <table> <tr> <td> <h3> <?php //if the cart is empty show the message if (!$cart && !$_POST['item']) { echo "No cart available."; $cart = array(); } else{ //if the new item added to the cart let the customer knows if ($_POST['item']) { echo "Added to your cart: " . $_POST['item']; } } ?> </h3> </td> </tr> <tr> <?php //if the cart isn't empty show the cart if ($cart) { $cart[] = $_POST['item'];} foreach($cart as $key => $value) { echo'<td> <img src="images/'.$value.'.jpg" alt="'.$value.'" /> </td> <td> <form> <p> '.$value.' = <input type="text" size="2" name="number" value="1" /> </p> </form> </td> <td> <form method="post" action="update.php"> <p> <input type="submit" name="submit" value="Update This One Item" /> </p> <form> </td> <br />'; } ?> </tr> </table> Hello, this is my first time on this forum and also a modest newb on php, but i heard alot of people i know visit this site to get help on php. So i have a question, i know how to submit a form to mysql, the question is how do i recieve each indivual data i submit with the form by date and display it in order by date. i would like to submit kind of a status up everyday similar to twitter but order it by date and have it look kinda like: July 5, 2006 This is a status example text that i will sumbit via form, links can be clicked and etc. This is a status example text that i will sumbit via form, links can be clicked and etc. This is a status example text that i will sumbit via form, links can be clicked and etc. July 4, 2006 This is a status example text that i will sumbit via form, links can be clicked and etc. This is a status example text that i will sumbit via form, links can be clicked and etc. hi all, mine http call : <script type="text/javascript"> var leadidarray =new Array(); leadidarray[1] = 100; leadidarray[2] = 200; leadidarray[3] = 300; leadidarray[4] = 400; leadidarray[5] = 500; var url = 'test.php?query=test&leadarray='+leadidarray; $.getJSON(url,function(data){}); <script> Now on the processing page i am getting $row = $_GET[leadarray] ; var_dump($_GET[leadarray]); or print_r( $_GET[leadarray] ); gives me values 100,200,300,400,500 but i want all that separate variables or all values in array so i can compare with another array, how can i do that? CREATE TABLE posts ( postId INT(11) NOT NULL UNIQUE AUTO_INCREMENT, title VARCHAR(255) NOT NULL, author VARCHAR(24) NOT NULL, description TEXT NOT NULL, createdAt TIMESTAMP, PRIMARY KEY (postId) ); CREATE TABLE comments( commentId INT(11) NOT NULL UNIQUE AUTO_INCREMENT, comment TEXT NOT NULL, postId INT(11), userId INT(11), createdAt TIMESTAMP, PRIMARY KEY (commentId), FOREIGN KEY (userId) REFERENCES users(userId), FOREIGN KEY (postId) REFERENCES posts(postId) ); CREATE TABLE replies ( repId INT(11) NOT NULL UNIQUE AUTO_INCREMENT, reply TEXT NOT NULL, userId INT(11), commentId INT(11), createdAt TIMESTAMP, PRIMARY KEY (repId), FOREIGN KEY (userId) REFERENCES users(userId), FOREIGN KEY (commentId) REFERENCES comments(commentId) ); CREATE TABLE users ( userId INT(11) NOT NULL UNIQUE AUTO_INCREMENT, userName VARCHAR(100) NOT NULL,, email VARCHAR(100) NOT NULL, PRIMARY KEY (userId) ); how to retrive userName,comment, and createdAt from users and comments table while I have used userId as a Foreign key on the comment table if it isn't correct, correct me please |