4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: Jaap12 on August 27, 2002, 03:09:24 PM

Title: Problem with php?
Post by: Jaap12 on August 27, 2002, 03:09:24 PM
Hi i have made this code for a modification :
Code: [Select]

<?
$dbase_connect = mysql_connect("localhost", "user", "pass");
mysql_select_db($dbnamehere, $dbase_connect); // ;
$sql = "SELECT * FROM 4images_images WHERE image_winkel BETWEEN 10 AND 40";
$resultaat = mysql_query($sql);

if ($result)
{

while ($image_winkel = mysql_fetch_object ($resultaat)) {
echo "<b>$image_winkel->winkel</b>\n";
}
}
else
{
echo "query mislukt".mysql_error();
}
?>



but i get this error:

query misluktNo Database Selected

but all the details are right
did i have seen something wrong?

Greetz,

Bas
Title: Problem with php?
Post by: Jan on August 27, 2002, 03:50:20 PM
Code: [Select]
if ($result)
{

must be
Code: [Select]
if ($resultaat)
{

Greets Jan
Title: Problem with php?
Post by: Jaap12 on August 27, 2002, 04:04:21 PM
makes no different same error :(

i have as table:

Code: [Select]
SELECT * FROM 4images_images WHERE image_test BETWEEN 10 AND 40

don't must be something like this?

Code: [Select]
SELECT * FROM i.4images_images WHERE i.image_test BETWEEN 10 AND 40
Title: Problem with php?
Post by: Jan on August 27, 2002, 04:05:55 PM
Are you sure that $dbnamehere is filled with the right database name?

Jan
Title: Problem with php?
Post by: Jaap12 on August 27, 2002, 04:36:18 PM
yep , i use the same details as 4images photo gallery
Title: Problem with php?
Post by: Jan on August 27, 2002, 04:40:22 PM
Can you post the whole script.

Jan
Title: this is
Post by: Jaap12 on August 27, 2002, 04:53:49 PM
This is the hole script.

This is only a command to read the data out the database and select the different prices. And let them display on a page. But it doesn't work.

I think this is the right solution. But i don't know the database structure from your application.
Title: Problem with php?
Post by: Jan on August 27, 2002, 04:55:42 PM
You don't set $dbnamehere.

Use
Code: [Select]
$dbnamehere = "Database_Name";
or
Code: [Select]
mysql_select_db("Database_Name", $dbase_connect);

Greets Jan
Title: Problem with php?
Post by: Jaap12 on August 27, 2002, 05:11:04 PM
sorry ,

but that's not the problem, i had set that to display the functions.
I know there must be my database name.

This was only for a example.

How do you use the "between"function?
Do you have a other way to show the data?
Title: Problem with php?
Post by: Jan on August 27, 2002, 05:35:45 PM
You have posted this error message:
Code: [Select]
No Database Selected
This means that have not selected a database correctly.

Jan
Title: Problem with php?
Post by: Nicky on August 27, 2002, 06:13:24 PM
mysql_select_db("YOURDBHERE", $dbase_connect);

is correct in your example for database connect, like Jan posted it allready