Error message on my test server

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!

Moderator: General Moderators

Post Reply
NuttyMonk
Forum Newbie
Posts: 4
Joined: Sat Oct 30, 2010 7:55 am

Error message on my test server

Post 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
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Re: Error message on my test server

Post 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?
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
NuttyMonk
Forum Newbie
Posts: 4
Joined: Sat Oct 30, 2010 7:55 am

Re: Error message on my test server

Post 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
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Re: Error message on my test server

Post 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.
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
Post Reply