Jump to content

[SOLVED] Help with error


ambo

Recommended Posts

<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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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