freelanceprogrammers.org Forum Index » PHP

MySQL Connection


Goto page Previous  1, 2, 3
View user's profile Post To page top
anuradika80 Posted: Wed Mar 09, 2005 6:25 pm


Joined: 24 Feb 2005

Posts: 17
MySQL Connection
hey guysssssss
i settle the prob
thats all the help from all of u, its bcoz
the table has to be tbl_bby, not tbl_BBY, caps lock
its recog as different table, its my mistak

again, thanks for all the helping hands...
:))

--- Sheila Fenelon <sfenelon@...> wrote:
> What does this tell you?
>
>
> $query = "Select txt_ID FROM tbl_BBY ";
> $result = mysql_query($query);
> if (mysql_errno()) {
> echo "<p>MySQL error: ". mysql_error() .
> "</p>";
> echo "<p>SQL: $query</p>";
> die;
> }
>
>
> Here`s another way to check for errors.
>
>
> $query = "Select txt_ID FROM tbl_BBY ";
> $result = mysql_query($query);
> if (!$result) {
> echo "<p>MySQL error: ". mysql_error() .
> "</p>";
> echo "<p>SQL: $query</p>";
> die;
> }
>
>
> --
> Sheila
> http://www.shefen.com/
>
>
>
> Anuradika Jaganadhan wrote:
> > it shows all the tables in the db, but i m aunable
> to
> > connect using
> > mysql_fetch_array():
> > mysql_fetch_assoc():
> > mysql_num_rows():
> > please help
> >
> >>>>4.1. I am using
> >>>>
> >>>>require("Conn_to_Mysql.php");
> >>>>$query = "Select * from tbl_BBY ";
> >>>>$result = mysql_query($query);
> >>>>while($row = mysql_fetch_array($result,
> >>>>MYSQL_ASSOC))
> >>>>{
> >>>>
> >>>>}
> >>>>
> >>>>Its running in my office pc, and my home pc, but
> >>>>when i upload to the
> >>>>webserver, its giving error as such, anyone able
> >>
> >>to
> >>
> >>>>help me to solve
> >>>>this issue.
> >>>>
> >>>>Warning: mysql_fetch_array(): supplied argument
> >>
> >>is
> >>
> >>>>not a valid MySQL
> >>>>result resource
> >>>>
> >>>>Thanks in advance.
> >>>>
> >>>>
> >>>
>
>

________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now
http://uk.messenger.yahoo.com/download/index.html
Reply with quote
Send private message
View user's profile Post To page top
fenelon_spencer Posted: Wed Mar 09, 2005 6:27 pm


Joined: 09 Mar 2005

Posts: 2
MySQL Connection
Where is `domain.` coming from? Is that something MySQL added to the
error message or does your query look like this?

$query = "Select txt_ID FROM domain.tbl_BBY ";


--
Sheila
http://www.shefen.com/


Anuradika Jaganadhan wrote:
> MySQL error: Table `domain.tbl_BBY` doesn`t exist
> but when i try to do SHOW TABLE, it does shows all the
> tables including tbl_BBY, please help
>
>
>
> --- Sheila Fenelon <sfenelon@...> wrote:
>
>>What does this tell you?
>>
>>
>>$query = "Select txt_ID FROM tbl_BBY ";
>>$result = mysql_query($query);
>>if (mysql_errno()) {
>> echo "<p>MySQL error: ". mysql_error() .
>>"</p>";
>> echo "<p>SQL: $query</p>";
>> die;
>>}
>>
>>
>>Here`s another way to check for errors.
>>
>>
>>$query = "Select txt_ID FROM tbl_BBY ";
>>$result = mysql_query($query);
>>if (!$result) {
>> echo "<p>MySQL error: ". mysql_error() .
>>"</p>";
>> echo "<p>SQL: $query</p>";
>> die;
>>}
>>
>>
>>--
>>Sheila
>>http://www.shefen.com/
>>
>>
>>
>>Anuradika Jaganadhan wrote:
>>
>>>it shows all the tables in the db, but i m aunable
>>
>>to
>>
>>>connect using
>>>mysql_fetch_array():
>>>mysql_fetch_assoc():
>>>mysql_num_rows():
>>>please help
>>>
>>>
>>>>>>4.1. I am using
>>>>>>
>>>>>>require("Conn_to_Mysql.php");
>>>>>>$query = "Select * from tbl_BBY ";
>>>>>>$result = mysql_query($query);
>>>>>>while($row = mysql_fetch_array($result,
>>>>>>MYSQL_ASSOC))
>>>>>>{
>>>>>>
>>>>>>}
>>>>>>
>>>>>>Its running in my office pc, and my home pc, but
>>>>>>when i upload to the
>>>>>>webserver, its giving error as such, anyone able
>>>>
>>>>to
>>>>
>>>>
>>>>>>help me to solve
>>>>>>this issue.
>>>>>>
>>>>>>Warning: mysql_fetch_array(): supplied argument
>>>>
>>>>is
>>>>
>>>>
>>>>>>not a valid MySQL
>>>>>>result resource
>>>>>>
>>>>>>Thanks in advance.
>>>>>>
>>>>>>
>>>>>
>>
>
Reply with quote
Send private message
View user's profile Post To page top
thiago_mata Posted: Wed Mar 09, 2005 9:44 pm


Joined: 09 Mar 2005

Posts: 1
MySQL Connection
Try this:

<?
$con = mysql_connect("localhost","root","password");
mysql_select_db("databasename",$con);
$result = mysql_query("show tables");
while($actual = mysql_fetch_array($result))
{
print $actual[0]."<br>
";
}
?>

Note the mysql_select_db have to receive the connection too.
[

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.1 - Release Date: 9/3/2005
Reply with quote
Send private message
View user's profile Post To page top
bimal_kcmit Posted: Fri Mar 18, 2005 3:08 pm


Joined: 18 Mar 2005

Posts: 1
MySQL Connection
Hello there,

If you have been always in trouble of creating protected pages,
and have done on there, here is my suggestion:

Always put the protection/login determining page into the
database variable configuration script. Since all of your pages
may refer to this config file (of course in .php), your pages
will be protected, because you have the logic there in
immediately after the datbase connection.

This prevents putting protection logic to indidual files, which
may be riskier if you forget to place any protection code there.

Bimal
NEPAL

Bimal Poudel
(Information Management)
Kathmandu, Nepal

http://fakenepal.tripod.com



__________________________________
Do you Yahoo!?
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250
Reply with quote
Send private message
Goto page Previous  1, 2, 3
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 3 of 3
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help