Jump to content

Quick Question - DB not accessible from on server?


Solarpitch

Recommended Posts

Heys Guys,

I've just uploaded my site onto the server today, just want to test some database connection and what not. When the application tries to access the DB I get the message "no database selected" in place of my result set.

heres an example of my syntax. "myDatabase has been created successfully in cpanel". The DB works fine locally.

[code]$mysql_connect = new mysqli("localhost", "admin", "********");
$mysql_connect->select_db('myDatabase');
[/code]

Anyone any ideas as to why? ^_^
Hi, there ya go. Now this all works perfect off the server. Problems just started once I uploaded it. If I put in the wrong password i'll get all the usual error messages abotu mysql_connect. . admin@local . . blah

[code]
$query = "SELECT count(*) FROM ads WHERE class = 'Irons' AND validation = 1";
$result = mysqli_query($mysql_connect, $query) or die (mysqli_error($mysql_connect));
[/code]
Oh . . I query it twice . . for pagination purposes.

[code]
$limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
$query = "SELECT * FROM adds WHERE class = 'Irons' AND validation = 1 ORDER BY '$orderby' $limit";
$result = mysqli_query($mysql_connect, $query) or die (mysqli_error($mysql_connect));
[/code]
[CODE]
<?php
$result = mysql_query($mysql_connect, $query) or die (mysqli_error($mysql_connect));
?>
[/CODE]
or try this
[CODE]
<?php
$result = mysql_query($query, $mysql_connect) or die (mysqli_error($mysql_connect));
?>
[/CODE]

in ur original one u had an i after mysqli
[quote author=chriscloyd link=topic=120902.msg496442#msg496442 date=1167864119]
[CODE]
<?php
$result = mysql_query($mysql_connect, $query) or die (mysqli_error($mysql_connect));
?>
[/CODE]
or try this
[CODE]
<?php
$result = mysql_query($query, $mysql_connect) or die (mysqli_error($mysql_connect));
?>
[/CODE]



[/quote]

Yeah . . neither seem to work. Do you guys really think it could be a problem with the query statements as they work perfect locally?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.