Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. That is fine. As long as you do it with each person logging in it should not be too bad. But for the first person to login in the morning it may take it a while to update the DB etc. You may limit that query to 10 or 20, so it does not take a huge toll on 1 particular user and it spreads it among many.
  2. Why not try to query it via phpMyAdmin with the where clause in? I saw up above you said you did it without the where clause...that is why it returns 2 results. The where clause is limiting it. So run it through phpMyAdmin with that where clause and then modify it that way before you venture into getting it to work in PHP. If you cannot even get it to work in PHPMyAdmin WITH the where clause then it will never work in PHP with the where clause.
  3. You are closing the tble too early. Put the </table> after the php and before the </body> Viewing the source of the page would have yielded the problem.
  4. Weird... Well as long as it works I guess that is all you can ask for. I just figured it would throw a header error since you printed the data but yeah.
  5. $a = mysql_query("SELECT SUM(`views`) FROM games WHERE uploader = '$session->username'"); $views = 0; if (mysql_num_rows($a) > 0) { $views = mysql_fetch_array($a); $views = $views[0]; if (empty($views) || $views == "") $views = 0; } echo $views; Try that. It is simple if logic....
  6. $a = mysql_query("SELECT SUM(`views`) FROM games WHERE uploader = '$session->username'"); $views = 0; if (mysql_num_rows($a) > 0) { $views = mysql_fetch_array($a); $views = $views[0]; } echo $views;
  7. No you need the exit. Without the exit it will always execute the no-image portion also. The whole point of the exit is so you can get rid of the else and if the script reaches the end of the page that means the correct conditions were not met. You need the exit in there.
  8. mysql_result, mysql_fetch_array, mysql_fetch_row.....etc etc.
  9. According to that statement, what is happening is there is that pic for showpic4. Check the data in the database for the ID you are passing. I took the else out to avoid duplicate data, that should work like expected if there is no image returned by the SQL Query. But obviously there is data being returned by the SQL Query. But I think I am understanding what you want to do. <?php require("global/admin_functions.php"); if (isset($_GET['adid'])) { $query = "SELECT thumbnail3,thumbnailtype3 FROM zloads where intProductID=".$_GET['adid']; $result = mysql_query($query); if (mysql_num_rows($result) > 0) { $data = mysql_result($result,0,"thumbnail3"); if (!empty($data) && $data != "") { $type = mysql_result($result,0,"thumbnailtype3"); Header( "Content-type: $type"); print $data; exit; } } } header("Content-Type: image/png"); $file = ('../pix/noimage.png'); $source = (fread(fopen($file, "r"), filesize($file))); print ($source); ?> Adding that if in there should test if that image has been set or not. Also you know you could consolidate this into 1 file instead of 4 or 5 different by doing this <?php require("global/admin_functions.php"); $thumbnailNum = isset($_GET['type'])?$_GET['type']:1; // default to 1 if no value if (isset($_GET['adid'])) { $query = "SELECT thumbnail" . $thumbnailNum . ",thumbnailtype" . $thumbnailNum . " FROM zloads where intProductID=".$_GET['adid']; $result = mysql_query($query); if (mysql_num_rows($result) > 0) { $data = mysql_result($result,0,"thumbnail" . $thumbnailNum); if (!empty($data) && $data != "") { $type = mysql_result($result,0,"thumbnailtype" . $thumbnailNum); Header( "Content-type: $type"); print $data; exit; } } } header("Content-Type: image/png"); $file = ('../pix/noimage.png'); $source = (fread(fopen($file, "r"), filesize($file))); print ($source); ?> Then just add type=x where x is 1 2 3 4 etc.... Let me know how that works.
  10. Sorry I feel like an idiot. Try this: <?php require("global/admin_functions.php"); if (isset($_GET['adid'])) { $query = "SELECT thumbnail3,thumbnailtype3 FROM zloads where intProductID=".$_GET['adid']; $result = mysql_query($query); if (mysql_num_rows($result) > 0) { $data = mysql_result($result,0,"thumbnail3"); $type = mysql_result($result,0,"thumbnailtype3"); Header( "Content-type: $type"); print $data; exit; } } header("Content-Type: image/png"); $file = ('../pix/noimage.png'); $source = (fread(fopen($file, "r"), filesize($file))); print ($source); ?> Changed < 1 to > 0 in the mysql_num_rows part.
  11. I know that some servers <?= is disabled so it is good practice to use <?php echo $id; ?> instead. Not sure if that is the issue, but are you sure that $id is being populated from the database? Post the code where the $id is being set, like that whole section of code.
  12. It sounds to me like you are not populating the adid. That is why you are not getting the image. http://www.yoursite.com/showpic3.php?adid=x Replace the x with the product id and see what comes out. As long as that has a value and the productid does indeed have a pic inside it should display just fine.
  13. Gotcha. <?php $values = implode("', '", $array); mysql_query("INSERT INTO table VALUES (" . $values . ")"); ?> Simple as that.
  14. <?php require("global/admin_functions.php"); if (isset($_GET['adid'])) { $query = "SELECT thumbnail3,thumbnailtype3 FROM zloads where intProductID=".$_GET['adid']; $result = mysql_query($query); if (mysql_num_rows($result) < 1) { $data = mysql_result($result,0,"thumbnail3"); $type = mysql_result($result,0,"thumbnailtype3"); Header( "Content-type: $type"); print $data; exit; } } header("Content-Type: image/png"); $file = ('../pix/noimage.png'); $source = (fread(fopen($file, "r"), filesize($file))); print ($source); ?> Try that. You should not query if $_GET does not have a variable in it. I would also do some data validation on the $_GET before using it in my query, but that is me.
  15. thanks but thats not related to my question So let me get this straight. You want to loop through the array and insert the values into it? Before I waste my time writing an example code you need to show me the full array structure and how it needs to be entered. Either do a print_r on the array you want to insert and paste it here or write it out on your own. Providing us with what you actually want is the key to getting your questioned answered without all this going back and forth with me just needing more basic information.
  16. serialize Make the DB field a text and use that function above. When retrieving it from a DB use unserialize
  17. I would think your DISTINCT * is throwing it off. I think you need to define a single column for DISTINCT cause if you have a time field, which I know you do, any time that matches up will not be returned more than once. What column should be distinct?
  18. It's not just you trust me. I could spend hours looking at my own code and miss something that small and I should have caught in the first 5 seconds of looking at it. That is just how your mind works. Sometimes printing the problem code on paper helps too.
  19. Then that means you have an error in your query. <?php require("global/admin_functions.php"); $query = "SELECT thumbnail3,thumbnailtype3 FROM zloads where intProductID=".$_GET['adid']; $result = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($result) > 0) { That is how it should be, run that and I bet you get an error in SQL query. If you need help to fix that post the error. If not fix it and it should work just fine.
  20. The flash application should not care where the MP3 file is located. I am not sure how that software works etc, but yea should be possible. However if you want them to be able to download it you may want to store the mp3s with a randomly generated hash for the file name, then use the DB to have them download with the original name etc. At least that is my 2 cents. But yea the flash player should not care where the MP3 is as long as you give it the correct path.
  21. $result = mysqli_query($database->connection,$sql);
  22. $get=mysql_query("SELECT ip FROM server1 WHERE IP='$ip'"); Should fix that problem. If you wanted to use single quotes inside single quotes you have to escape them. Simple as that.
  23. If the site is not currently coded for it you will have to re-code the site. What you can do while you recode is put in language definitions and make them dynamic. What I do is store any phrase in a database with a column country, then when the script loads execute a query in a language file and pull out all the tables for that language and make them constants then just use those common constant names. Table would have: languageid, language, text, constantname Once that is done, you can add any language you want just by adding a selction option and writing out everything in that table for the new language. Hope that helps.
  24. Where is the $_GET being set when you post the data? I do not see that anywhere... If you put it in a hidden field it would become $_POST instead of $_GET
  25. There cannot be a WHERE in the insert. You would use the UPDATE syntax to perform that. $insert = "UPDATE users SET mygroups = '$groupname' WHERE username = '$username'"; If you are indeed meaning to insert, the question is why are you trying to choose a specific username? Usually you insert their username in there. I think you meant update though.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.