bob2588 Posted October 24, 2009 Share Posted October 24, 2009 i am having a problem with a while statement here is the code <?php session_start(); if(!session_is_registered(username)){ header('location:login.php'); } ?> <?php include'db.php'; // Php Suubmit if and mysql insert if(isset($_POST['Submit'])) { $code=$_POST['code']; mysql_query("INSERT INTO Ads (id, Html) VALUES( NULL, '$code' ) ") or die(mysql_error()); // pull out code $result = mysql_query("SELECT * FROM Code WHERE id='1'"); while($row = mysql_fetch_array($result)) //find ad id $res = mysql_query("SELECT * FROM Ads WHERE html='$code'"); while($row1 = mysql_fetch_array($res)) echo" <label> <textarea name='paste_code' id='paste_code' cols='100' rows='5'> <?php include 'db.php'; ". $row['ad'] ." = mysql_query(". $row['lick'] ." SELECT * FROM Ads WHERE id='". $row1['id'] ." '". $row['lick'] ." ); while(". $row['row'] ." = mysql_fetch_array(". $row['ad'] .")) { ". $row['echo1'] ." ". $row['echo2'] ." } ?> </textarea> </label>"; } else { echo" <table width='439' height='351' border='0'align='center'> <tr> <td width='293'><form id='form1' name='form1' method='post' action=''> <label></label> Paste Html Here </td> <td width='136'> </td> </tr> <tr> <td><textarea name='code' id='code' cols='45' rows='5'></textarea></td> <td> </td> </tr> <tr> <td><label> <center> <input type='submit' name='Submit' id='Submit' value='Submit' /></center> </label> </form></td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table>"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Add</title> </head> <body> </body> </html> it does not pull out both just one i am writing the code wrong thank you bob Link to comment https://forums.phpfreaks.com/topic/178800-solved-while-problem/ Share on other sites More sharing options...
bob2588 Posted October 24, 2009 Author Share Posted October 24, 2009 i fore got to put the { and } in sorry should look like this <?php session_start(); if(!session_is_registered(username)){ header('location:login.php'); } ?> <?php include'db.php'; // Php Suubmit if and mysql insert if(isset($_POST['Submit'])) { $code=$_POST['code']; mysql_query("INSERT INTO Ads (id, Html) VALUES( NULL, '$code' ) ") or die(mysql_error()); // pull out code $result = mysql_query("SELECT * FROM Code WHERE id='1'"); while($row = mysql_fetch_array($result)) { //find ad id $res = mysql_query("SELECT * FROM Ads WHERE html='$code'"); while($row1 = mysql_fetch_array($res)) { echo" <label> <textarea name='paste_code' id='paste_code' cols='100' rows='5'> <?php include 'db.php'; ". $row['ad'] ." = mysql_query(". $row['lick'] ." SELECT * FROM Ads WHERE id='". $row1['id'] ." '". $row['lick'] ." ); while(". $row['row'] ." = mysql_fetch_array(". $row['ad'] .")) { ". $row['echo1'] ." ". $row['echo2'] ." } ?> </textarea> </label>"; } } } else { echo" <table width='439' height='351' border='0'align='center'> <tr> <td width='293'><form id='form1' name='form1' method='post' action=''> <label></label> Paste Html Here </td> <td width='136'> </td> </tr> <tr> <td><textarea name='code' id='code' cols='45' rows='5'></textarea></td> <td> </td> </tr> <tr> <td><label> <center> <input type='submit' name='Submit' id='Submit' value='Submit' /></center> </label> </form></td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table>"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Add</title> </head> <body> </body> </html> Bob Link to comment https://forums.phpfreaks.com/topic/178800-solved-while-problem/#findComment-943243 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.