PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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?
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
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.
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.
<?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'");
?>