GetAWeapon
-
Posts
11 -
Joined
-
Last visited
Posts posted by GetAWeapon
-
-
I think my mistake is in my selection from my tables:
$sqlget = "SELECT * FROM artikel, images LIMIT $start_from, 20 ";
Normally to set my 2 keys the same I need to do this:
WHERE artikel.A_ARTCODE = images.I_ARTCODE
But when I do this, then I only got 2 products left, I just want to see all my products even when they don't got a picture.
-
I changed it to this:
echo "<img src='". IMAGE_PATH . $row['I_PATH']. '/' . $row['I_ID']. '.png' ."' />";
But still got the same result, really strange
-
Noooo, I still got a bug, in my 2 tables, I got 2 keys, one array called 'A_ARTCODE' and in my other one for the images 'I_ARTCODE'. Normally those 2 ID's need to be te same.So normally every product will have his own picture and ID. But now I got this:
https://www.dropbox.com/s/mwcadcjbi4ol8cr/wrongid.jpg
So the only products that should have a picture, that are the first 2, I think I made a mistake by making a fixed path like this:
define('IMAGE_PATH', 'images/000000-001000/');
So I need to make a relative path in this line:
echo "<img src='". IMAGE_PATH . $row['I_ID']. '.JPG' ."' />";
theoretical it should be something like I_PATH + I_FILE, the path is the name of the folder and the file is the name of my picture. How can put this in php code?
-
Ah, nvm, it works now, I founded it
didn't knew there was another map in the images map xd stupped hidden path
define('IMAGE_PATH', 'images/000000-001000/'); echo "<img src='". IMAGE_PATH . $row['I_ID']. '.JPG' ."' />";
-
Ok thanks, now I doesn't direct me to my localhost anymore. But I still got no results, really strange. My url is now this: http://dbfact.consult4u.be/images/NWADLIDES-1005D
I really thought it should work. Is it possible, it doens't work because there is no '.jpg' behind the url?
My code atm is this:
echo "<img src='". IMAGE_PATH . $row['I_PATH' + 'I_ID']."' />";
-
Oooh nvm, my collague, fckd it up. Forget my post before, It's totally worthless.
Now I did this:
echo "<img src='".$row['I_PATH' + 'I_ID']."' />";
I get this as result in the url: http://localhost/DBFact/NWADLIDES-1005D
I think that's almost good, but you see, it goes to the localhost, but it should go to my online host, where my database is... how can I do that?
-
Ya but if that worked, I wouldn't putted // in front of it xD
Like you say, yes indeed, when I do that I get a icon that there is no image found. But it's not that what I need, there are images behind the word 5.jpg and 6.jpg, it's really strange. I'll show you a picture in this post with the proof of it.
Maybe I explained not good enough, my collague made also a version from it and had this and normally it's the same code, I'll double check it after this post. But I'm sure it was the same.
https://www.dropbox.com/s/j8q8frdufj9jtn7/strange.jpg
Like you see, every name end with 5.jpg in this example, but when I scroll down, a bunch of them ends with 6.jpg. So if im right, the part in front of that makes the url or path to that picture complete.
So how can I display this like an image?
I thougth something like this: [frontcode]+[i_FILE]=complete url/path and that should give the pictures if I'm right. I think my idea can work, but I don't know how to put this in code.
I'm only a noob at php and it's my 5 day I use php in my life.
-
Hello, like I promised, I'm back with another problem. This one will be harder xD so squeeze your brain
Now I've got a webpage, with a database shown into a table, under that I've got page numbers. So I got my 20 rows for each page.
https://www.dropbox.com/s/txsinttizihiwo5/stillnotok.jpg
Great/awesome so far
Now I've got a new problem and it's hard for me to explain this too.
In my database I got allot of tables, in my webpage I'm using 2 of them, called 'artikel' and 'images".
Everything from my artikel table is ok. So we don't need to look at that.
But my problem is with the table 'images'.
In that table I got 2 items.
Like you will see in my code, I need the I_ARTCODE and I_FILE
in I_ARTCODE stands: 14 and for the other image 15
in I_FILE stands: 5.jpg and for the other image 6.jpg
With the code I've got now, I display the word 5.jpg and 6.jpg.
But I need to display the picture behind that, the person who gave me this task sayed, I normally can do this with the pad but it's not a real url, I'll give you guys a picture how my database looks like:
https://www.dropbox.com/s/lfac7gzr1uqplxd/path.jpg
Over here the pad is this: 000000-001000
It doesn't seems normal to me and I can't find a sollution for this on the internet.
Can someone plz help me?
Ooh ya, almost forgot, this is my code:
<?php include('connect-mysql.php'); if (!empty($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; }; $start_from = ($page-1) * 20; $sqlget = "SELECT * FROM artikel, images LIMIT $start_from, 20 "; $sqldata = mysqli_query($dbcon, $sqlget) or die('error getting'); echo "<table>"; echo "<tr><th>A_ARTCODE</th><th>A_NUMMER</th><th>A_OMSCHRN</th><th>A_REFLEV</th><th>A_WINKEL</th><th>I_ARTCODE</th><th>I_FILE</th></tr>"; while($row = mysqli_fetch_array($sqldata)){ echo "<tr><td align='right'>"; echo $row['A_ARTCODE']; echo "</td><td align='left'>"; echo $row['A_NUMMER']; echo "</td><td align='left'>"; echo $row['A_OMSCHRN']; echo "</td><td align='left'>"; echo $row['A_REFLEV']; echo "</td><td align='right'>"; echo $row['A_WINKEL']; echo "</td><td align='right'>"; echo $row['I_ARTCODE']; echo "</td><td align='right'>"; echo $row['I_FILE']; //echo "<img src='000000-001000".$row['I_ID']."' />"; echo "</td></tr>"; } echo "</table>"; $sql = "SELECT COUNT(A_ARTCODE) FROM artikel"; $rs_result = mysqli_query($dbcon, $sql) or die ("mysqli query dies"); $row = mysqli_fetch_row($rs_result) or die ("mysqli fetch row dies"); $total_records = $row[0]; $total_pages = ceil($total_records / 20); for ($i=1; $i<=$total_pages; $i++) { echo "<a href='index.php?page=".$i."'>".$i."</a> "; }; ?>
-
Oooooh yes, ofcourse, why didn't I think of that xD I just needed to replace this:
$sqlget = "SELECT *FROM artikel, imagesLIMIT 0, 20";to$sqlget = "SELECT *FROM artikel, imagesLIMIT $start_from, 20";Thanks for the fast support, I'm really greatfull, but I also got another question, but I'll guess I better make another topic for it or not? -
Hello everyone,
I new to the php world and I'm only working with it for 5 days now. So I'm a noob
But I've got a good start atm, I already could connect a database with my webpage and show all my coloms I need.
Now I got a problem with the fact, my database is way to big to display on 1 page. To much load-time, so that's the reason why I want to split up all my products.
20 for each page, like in this tutorial: http://www.phpjabbers.com/php--mysql-select-data-and-split-on-pages-php25.html?err=1
I think I'm almost there, my problem is that when I click on the number from the next page (like nr 5), it doesn't show my next 20 products.
But when I look to the url, that seems ok, because I get something like this; index.php?page=1
Can someone help me to find out, what I did wrong? And plz, remember, if you give me an answer, plz keep it short and simple. I'm a noob at this.
This is my code:
<?php include('connect-mysql.php'); if (!empty($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; }; $start_from = ($page-1) * 20; $sqlget = "SELECT * FROM artikel, images LIMIT 0, 20 "; $sqldata = mysqli_query($dbcon, $sqlget) or die('error getting'); echo "<table>"; echo "<tr><th>A_ARTCODE</th><th>A_NUMMER</th><th>A_OMSCHRN</th><th>A_REFLEV</th><th>A_WINKEL</th><th>I_ARTCODE</th><th>I_FILE</th></tr>"; while($row = mysqli_fetch_array($sqldata)){ echo "<tr><td align='right'>"; echo $row['A_ARTCODE']; echo "</td><td align='left'>"; echo $row['A_NUMMER']; echo "</td><td align='left'>"; echo $row['A_OMSCHRN']; echo "</td><td align='left'>"; echo $row['A_REFLEV']; echo "</td><td align='right'>"; echo $row['A_WINKEL']; echo "</td><td align='right'>"; echo $row['I_ARTCODE']; echo "</td><td align='right'>"; echo $row['I_FILE']; //echo "<img src='000000-001000".$row['I_ID']."' />"; echo "</td></tr>"; } echo "</table>"; $sql = "SELECT COUNT(A_ARTCODE) FROM artikel"; $rs_result = mysqli_query($dbcon, $sql) or die ("mysqli query dies"); $row = mysqli_fetch_row($rs_result) or die ("mysqli fetch row dies"); $total_records = $row[0]; $total_pages = ceil($total_records / 20); for ($i=1; $i<=$total_pages; $i++) { echo "<a href='index.php?page=".$i."'>".$i."</a> "; }; ?>
I hope someone can help me.
Getting pictures out the database
in PHP Coding Help
Posted
Thanks for your reply, but yes, my problem with that link already got fixed with this:
And my problem after that also got fixed a couple of minutes ago with this:
Anyway thank you very much for your help making some time for my problem. But for now everthing is fixed