ambo Posted September 24, 2008 Share Posted September 24, 2008 <br /> <table border="0" width="100%"> <tr> <td width="5%" bgcolor="#FFFF00"> </td> <td width="10%" bgcolor="#FFFF00"> <p align="center"><font size="2">Date / Time start</font></td> <td width="10%" bgcolor="#FFFF00"> <p align="center"><font size="2">Date / Time end</font></td> <td width="18%" bgcolor="#FFFF00"> <p align="center"><font size="2">Event Type</font></td> <td width="20%" bgcolor="#FFFF00"> <p align="center"><font size="2">Event Location</font></td> <td width="40%" bgcolor="#FFFF00"> <p align="center"><font size="2">Details (contacts, etc)</font></td> </tr> <? $query = "SELECT * from events order by event_start"; $result = mysql_query($query, $mysql_link); while($row=mysql_fetch_row($result)) { ?> Thats code Code in Red is Line 218 - 219 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/content/m/h/p/mhpmavrick/html/Pages/Decura/index.php on line 218 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/content/m/h/p/mhpmavrick/html/Pages/Decura/index.php on line 219 Quote Link to comment https://forums.phpfreaks.com/topic/125662-solved-help-with-error/ Share on other sites More sharing options...
DarkWater Posted September 24, 2008 Share Posted September 24, 2008 First of all, don't use short tags. Second of all, add "or die(mysql_error());" on the end of the mysql_query() call. Quote Link to comment https://forums.phpfreaks.com/topic/125662-solved-help-with-error/#findComment-649722 Share on other sites More sharing options...
darkfreaks Posted September 24, 2008 Share Posted September 24, 2008 additionally you should use mysql_fetch_array() instead of mysql_fetch_row Quote Link to comment https://forums.phpfreaks.com/topic/125662-solved-help-with-error/#findComment-649761 Share on other sites More sharing options...
ambo Posted September 24, 2008 Author Share Posted September 24, 2008 <? $query = "SELECT * from events order by event_start"; $result = mysql_query($query, $mysql_link); while($row=mysql_fetch_array($result)) { or die(mysql_error())} ?> So it should look like that Quote Link to comment https://forums.phpfreaks.com/topic/125662-solved-help-with-error/#findComment-649779 Share on other sites More sharing options...
DarkWater Posted September 24, 2008 Share Posted September 24, 2008 No... $result = mysql_query($query, $mysql_link) or die(mysql_error()); That's what I meant. Also, don't use <?. Use <?php. Quote Link to comment https://forums.phpfreaks.com/topic/125662-solved-help-with-error/#findComment-649786 Share on other sites More sharing options...
ambo Posted September 24, 2008 Author Share Posted September 24, 2008 OK thats fixed but now im having trouble with posting data, i keep getting errors no for the admin scripts This is my Form <form method="post" action="eventprocess.php"> Convention ID:<input type="text" name="id" size="7">(this is the unique ID # for the event)<br> <font color="#008000">Start</font> Date/Time:<input type="text" name="start" size="20">YYYY-MM-DD<br> Event <font color="#FF0000">End</font> Date/Time:<input type="text" name="end" size="20">YYYY-MM-DD<br> Event Type:<input type="text" name="type" size="20">(meeting, etc)<br> Event Location:<input type="text" name="location" size="20">(Hotel? Convention room? etc)<br> Event Details:<input type="text" name="details" size="20">(who am I meeting, cell phone number, etc)<br> Event Notes:<input type="text" name="notes" size="20">(notes of my visit) <input type="submit" value="Submit New Event"> <input type="hidden" name="action" value="submit_new_event"> </form> This is My eventsprocess.php <?php $con = mysql_connect("localhost","user","Password"); //Replace with your actual MySQL DB Username and Password if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("db", $con); //Replace with your MySQL DB Name $CONVENTION_ID=mysql_real_escape_string($_POST['id'], 'intonly'); $event_start=mysql_real_escape_string($_POST['start'], ''); $event_end=mysql_real_escape_string($_POST['end'], ''); $event_type=mysql_real_escape_string($_POST['type'], ''); $event_location=mysql_real_escape_string($_POST['location'], ''); $event_details=mysql_real_escape_string($_POST['details'], ''); $event_notes=mysql_real_escape_string($_POST['notes'], 'htmlok'); $sql="INSERT INTO events (CONVENTION_ID,event_start,event_end,event_type,event_location,event_details,event_notes) VALUES ('$CONVENTION_ID','$event_start','$event_end','$event_type','$event_location','$event_details','$event_notes')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "The form data was successfully added to your database."; mysql_close($con); ?> and when i submit i get Warning: mysql_real_escape_string() expects parameter 2 to be resource, string given in /home/content/m/h/p/mhpmavrick/html/Pages/Decura/admin/eventprocess.php on line 9 Warning: mysql_real_escape_string() expects parameter 2 to be resource, string given in /home/content/m/h/p/mhpmavrick/html/Pages/Decura/admin/eventprocess.php on line 10 Warning: mysql_real_escape_string() expects parameter 2 to be resource, string given in /home/content/m/h/p/mhpmavrick/html/Pages/Decura/admin/eventprocess.php on line 11 Warning: mysql_real_escape_string() expects parameter 2 to be resource, string given in /home/content/m/h/p/mhpmavrick/html/Pages/Decura/admin/eventprocess.php on line 12 Warning: mysql_real_escape_string() expects parameter 2 to be resource, string given in /home/content/m/h/p/mhpmavrick/html/Pages/Decura/admin/eventprocess.php on line 13 Warning: mysql_real_escape_string() expects parameter 2 to be resource, string given in /home/content/m/h/p/mhpmavrick/html/Pages/Decura/admin/eventprocess.php on line 14 Warning: mysql_real_escape_string() expects parameter 2 to be resource, string given in /home/content/m/h/p/mhpmavrick/html/Pages/Decura/admin/eventprocess.php on line 15 The form data was successfully added to your database. Quote Link to comment https://forums.phpfreaks.com/topic/125662-solved-help-with-error/#findComment-649887 Share on other sites More sharing options...
darkfreaks Posted September 24, 2008 Share Posted September 24, 2008 remove the extra ,"" after the variable Quote Link to comment https://forums.phpfreaks.com/topic/125662-solved-help-with-error/#findComment-649894 Share on other sites More sharing options...
ambo Posted September 24, 2008 Author Share Posted September 24, 2008 Ok that fixed that but now i have this for code mysql_select_db("decurauser", $con); //Replace with your MySQL DB Name $CONVENTION_ID=mysql_real_escape_string($_POST['id'], $event_start=mysql_real_escape_string($_POST['start'], $event_end=mysql_real_escape_string($_POST['end'], $event_type=mysql_real_escape_string($_POST['type'], $event_location=mysql_real_escape_string($_POST['location'], $event_details=mysql_real_escape_string($_POST['details'], $event_notes=mysql_real_escape_string($_POST['notes'], $sql="INSERT INTO events (CONVENTION_ID,event_start,event_end,event_type,event_location,event_details,event_notes) VALUES ('$CONVENTION_ID','$event_start','$event_end','$event_type','$event_location','$event_details','$event_notes')" ?> I Highlighted line 17 in red And this for error Parse error: parse error, unexpected ';' in /home/content/m/h/p/mhpmavrick/html/Pages/Decura/admin/eventprocess.php on line 17 Quote Link to comment https://forums.phpfreaks.com/topic/125662-solved-help-with-error/#findComment-649906 Share on other sites More sharing options...
CroNiX Posted September 24, 2008 Share Posted September 24, 2008 Missing a semi-colon at the end of the previous line. Quote Link to comment https://forums.phpfreaks.com/topic/125662-solved-help-with-error/#findComment-649961 Share on other sites More sharing options...
ambo Posted September 25, 2008 Author Share Posted September 25, 2008 Thank you Quote Link to comment https://forums.phpfreaks.com/topic/125662-solved-help-with-error/#findComment-650194 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.