473,322 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

help with very simple php problem...

max
Hi, I've just started learning some stuff about php and have been
following a couple of tutorials. At the moment I'm stuck with this small
piece of code which gives me an error "mysql_fetch_array():supplied
argument is not a valid MySql result"

<?php
include 'config.php';
include 'opendb.php';

$query="SELECT cname, csubject, cmessage FROM contact";
$result=mysql_query($query);

while($row= mysql_fetch_array($result,MYSQL_ASSOC))
{
echo
"Name :{$row['cname']} <br>" . "Subject : {$row['csubject']} <br>" .
"Message : {$row['cmessage']} <br><br>";
}
include 'closedb.php';
?>

This should just display the content of a table..
Thanx for your help!
Jul 17 '05 #1
3 1304
max
max probably wrote the following stuff on 16/07/2005 13.01:
This should just display the content of a table..
Thanx for your help!


Nevermind it's all working now, I just messed up with the DB connections
so it was looking in the wrong place! :-D
Jul 17 '05 #2

"max" <no****@nospam.com> wrote in message
news:BO*****************@twister1.libero.it...
Hi, I've just started learning some stuff about php and have been
following a couple of tutorials. At the moment I'm stuck with this small
piece of code which gives me an error "mysql_fetch_array():supplied
argument is not a valid MySql result"

<?php
include 'config.php';
include 'opendb.php';

$query="SELECT cname, csubject, cmessage FROM contact";
$result=mysql_query($query);

while($row= mysql_fetch_array($result,MYSQL_ASSOC))
{
echo
"Name :{$row['cname']} <br>" . "Subject : {$row['csubject']} <br>" .
"Message : {$row['cmessage']} <br><br>";
}
include 'closedb.php';
?>

This should just display the content of a table..
Thanx for your help!


Could you please show the contents of opendb.php?

Shelly
Jul 17 '05 #3
max
Shelly probably wrote the following stuff on 16/07/2005 13.26:
Could you please show the contents of opendb.php?


yeah I realized too that the problem was in there...actually in the
config.php since the opendb.php has variables that relate with the
config file.
Now everything is ok,
Thank you!
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
by: da Vinci | last post by:
OK, this has got to be a simple one and yet I cannot find the answer in my textbook. How can I get a simple pause after an output line, that simply waits for any key to be pressed to move on? ...
9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
6
by: francisco lopez | last post by:
ok , first of all sorry if my english is not so good, I do my best. here is my problem: I don´t know much javascript so I wrote a very simple one to validate a form I have on my webpage. ...
12
by: chreo | last post by:
I GIVE UP...I can't refresh datagrid (dataset) I have datagrid = dgrPaczki Datasource of that datagrid = DataSetPaczki1.PACZKI_PAKOWALNIA (forgive me Polish words) Dataadapter which fills my...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
4
by: 73k5blazer | last post by:
Hello again all.. We have a giant application from a giant software vendor that has very poor SQL. It's a PLM CAD application, that makes a call to the db for every cad node in the assembly. So...
2
by: astrogirl77 | last post by:
Hi, I'm new to Python and am hoping to find help with coding a Python script, applet. I code in an old version of Visual Basic 4.0, I have a simple app that is about 3 and a half pages of code...
1
by: astrogirl77 | last post by:
I'm new to C++ and am hoping to find help with coding a simple C program, am wanting to obtain code and functioning exe's. I code in an old version of Visual Basic 4.0, I have a simple app that...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.