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? ^_^ Link to comment https://forums.phpfreaks.com/topic/32763-quick-question-db-not-accessible-from-on-server/ 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? Link to comment https://forums.phpfreaks.com/topic/32763-quick-question-db-not-accessible-from-on-server/#findComment-152524 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] Link to comment https://forums.phpfreaks.com/topic/32763-quick-question-db-not-accessible-from-on-server/#findComment-152527 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)); Link to comment https://forums.phpfreaks.com/topic/32763-quick-question-db-not-accessible-from-on-server/#findComment-152529 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] Link to comment https://forums.phpfreaks.com/topic/32763-quick-question-db-not-accessible-from-on-server/#findComment-152530 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 Link to comment https://forums.phpfreaks.com/topic/32763-quick-question-db-not-accessible-from-on-server/#findComment-152531 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 Link to comment https://forums.phpfreaks.com/topic/32763-quick-question-db-not-accessible-from-on-server/#findComment-152532 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? Link to comment https://forums.phpfreaks.com/topic/32763-quick-question-db-not-accessible-from-on-server/#findComment-152534 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.