Dell XPS 13 9370 (2018) review
I recently designed a php/MySQL web site. The database has 3 tables. properties, pages and users.
The data stored in the pages table displays fine, the Users table also works great. Now..
When I am trying to display the contents of the properties table, all goes PT.
I get errors on the page, if I silence the errors using '@' I obviously get a null return.
However, if I change the query to read from the pages table, then I get a perfect result, no problems.
The only problem is, I don't want to view the pages table where the properties are supposed to be!!..
If I put:
$query = "SELECT COUNT(*) FROM properties ORDER BY pageID ASC";
I get an error return on these lines:
$row = mysql_fetch_array ($result, MYSQL_NUM);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
I have stripped the properties table right down to only having the primary key row in the table and it stilldoes it, but if I change the query over to pages, it displays fine and behaves as it should..
Am I doing something wrong or missing something out??
If I go into MySQL prompt, type in SELECT * FROM properties;
I get the result that I need on the pages, so I know that the DB is fine.
Thanks for that HT..
Another I eventually figured out was to ORDER BY the primary key.. that seemed to work too...
All I need to do now is figure out a way of displaying the images from the DB...that's another story..
How are you storing the images?
I assume they are uplaoded to a folder on the site ( I can't believe your storing them as binary in the db!)
How i do it is when you upload the pictures, rename them to include the primary key (auto number from the database)
Then all you need to do is link using the new name.
See an example: click here
I was thinking of using binary...but seeing as you've siad that..
I have got a folder on the site for the property images etc already..
Just figuring it all out...having made the move from designer to developer..it's a completely different ball game..
All I used to do is design the pages..the developers handled all this side..now I know why..
welcome to the real world.
If you store jpg files as binary in your database, you will soon exceed your allowed space (usually limited to 10% of your disc space) Not to mention all the other problems.....
Heres how you get the last primary_key ( of whatever you have named it) from the database.
$select = "SELECT primary_key FROM property WHERE primary_key = '$lastid'";
$results = mysql_query("$select", $link_id);
$query_data = mysql_fetch_row($results);
$key = $query_data;
This thread is now locked and can not be replied to.