Page 1 of 1
Error message on my test server
Posted: Wed Feb 23, 2011 7:55 am
by NuttyMonk
hi all,
i get this error messge on my test server (wamp on my windows pc at home) but when the site is on my webspace which has the same version of php, everything works fine without any error messages.
can anyone offer an explanation on the reason for this?
Cheers
Code: Select all
Warning: mysql_data_seek() [function.mysql-data-seek]: Offset 0 is invalid for MySQL result index 13 (or the query data is unbuffered) in C:\wamp\www\custAvail.php on line 116
Re: Error message on my test server
Posted: Wed Feb 23, 2011 8:18 am
by Pazuzu156
Question. How new is your WAMP server and what does line 116 in C:\wamp\www\custAvail.php say on your PHP page?
Re: Error message on my test server
Posted: Wed Feb 23, 2011 10:03 am
by NuttyMonk
i just installed WAMP last night for the first time. I'm using older versions of the PHP and mySQL packages though becuase they correspond to what's on my webspace hosting package.
this is line 116...
mysql_data_seek($bookingsToday, 0);
and this is where the $bookingsToday variable gets its data from earlier in the script...
$bookingsToday = mysql_query("SELECT * FROM bookingsTable WHERE theDay = '" . $day . "' AND theMonth = '" . $month . "' AND theYear = '" . $year . "' AND roomAssigned = '" . $r . "' AND enquiry != '1' AND enquiry != '3' ORDER BY 'bookingIndex'");
The odd thing is that this is all fine on my webspace. I really just want to get my WAMP server working inline with that so i can fully develop on my pc without touching the actual website and so i know that what i make on the WAMP server will work fine on my site too.
cheers
NM
Re: Error message on my test server
Posted: Thu Feb 24, 2011 7:31 am
by Pazuzu156
You did something to connect to your database. If you made a constants page to define your variables for server name, etc. What you need to do is configure your connections to connect to the database. Here is an example of how to do this IF you have not configured your phpMyAdmin or MySQL.
constants.php
Code: Select all
<?php
//define constants
define('DB_SERVER', 'localhost');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_NAME', 'your_database_name');
?>
your_page.php
Code: Select all
<?php
require('constants.php');
//connect to database and select it
$connect = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die (mysql_error());
$dbconnect = mysql_select_db(DB_NAME) or die (mysql_error());
//your query here
$bookingsToday = mysql_query("SELECT * FROM bookingsTable WHERE theDay = '" . $day . "' AND theMonth = '" . $month . "' AND theYear = '" . $year . "' AND roomAssigned = '" . $r . "' AND enquiry != '1' AND enquiry != '3' ORDER BY 'bookingIndex'");
?>
Maybe this will help you.