Hello,
I have a query in a file ../assets/modules/resorts/update.php
but the query doesn’t show anything :S
the code of the query it is:
$mydb= new DBAPI();
$mydb->connect($host=’localhost’,$dbase=’oprc’, $uid=’root’,$pwd=’’);
$ds ="SELECT * FROM `pais` WHERE `continente`=’".$_GET[’continente’]."’";
$result = $mydb->query($ds);
while ($linha = mysql_fetch_array($result)) {
echo "<option value=\"" . $linha[’id_pais’] . "\">" . $linha[’pais’] . "</option>";
}
I need include any file? Why the query doesn’t work?
Don’t you get an error here? Shouldn’t
$mydb->connect($host='localhost',$dbase='oprc', $uid='root',$pwd='');
be
$mydb->connect($host='localhost',$dbase='oprc', $uid='root',$pwd=''");
besides anything else.
Use MODx, or the cat gets it!
but I still have the same problem :S
I don’t understand, I don’t have any error... but the query doesn’t return anything
I think the problem it’s because I have a link at anoyher page,backend.php : ../assets/modules/resorts/actualiza.php?valor=$valor
because the query work on this page, but doesn’t work at the current page, actualiza.php
You undertand? :S
Sorry, my bad, your code itself s Ok, maybe a context thing, your backend.php file might be including something the query needs, that its not getting standalone.
Use MODx, or the cat gets it!
I tried to run another query:
$modx->db->connect(’localhost’, ’oprc’, ’root’, ’’, true);
$res = $modx->db->select(’*’, ’pais’);
while($tmp = $modx->db->getRow($res, ’pais’))
{
echo $tmp[’pais’];
}
but when I execute I have an error: Call to a member function connect() on a non-object in C:\wamp\www\modx-OPRC\assets\modules\resorts\actualiza.php on line 2
What’s happening?