Solarpitch Posted January 3, 2007 Share Posted January 3, 2007 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? ^_^ Quote Link to comment Share on other sites More sharing options...
trq Posted January 3, 2007 Share Posted January 3, 2007 Can we see where you try and query the database? Quote Link to comment Share on other sites More sharing options...
Solarpitch Posted January 3, 2007 Author Share Posted January 3, 2007 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] Quote Link to comment Share on other sites More sharing options...
chriscloyd Posted January 3, 2007 Share Posted January 3, 2007 $result = mysqli_query($query, $mysql_connect) or die (mysqli_error($mysql_connect)); Quote Link to comment Share on other sites More sharing options...
Solarpitch Posted January 3, 2007 Author Share Posted January 3, 2007 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] Quote Link to comment Share on other sites More sharing options...
chriscloyd Posted January 3, 2007 Share Posted January 3, 2007 [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 Link to comment Share on other sites More sharing options...
chriscloyd Posted January 3, 2007 Share Posted January 3, 2007 oh my bad i did not read the first part Quote Link to comment Share on other sites More sharing options...
Solarpitch Posted January 3, 2007 Author Share Posted January 3, 2007 [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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.