Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. You don't have a $ in front of the variable. <td width="400px"><?= $UserInfo['ID']?></td>
  2. Session's don't work from the command line. And you really don't want your cron job to return anything unless it's an error. If you want it to execute in the "web" sense, then you would have to use wget... * * * * * /usr/bin/wget http://http://secrettrance.net/petstatsedit.php Note that I didn't use the petcronjob.php file. If you aren't familiar with php from the command line, now would be a good time to get acquainted.
  3. You may have to start $x at 1, rather than 0, or your first row could have 6 td's.
  4. yes, you would still need it...and something to fill out any remaining td's to make the rows even: $x = 0; echo '<tr>'; while($row2 = mysql_fetch_assoc($new_games)){ if ($x % 5 == 0) { echo '</tr><tr>'; } $x++; echo '<td>'; echo'<center>'; echo '<font size=3>'; echo '<img src="gamepic/'; echo $row2['game_picture_url']; echo '" height="120" width="120"><br>'; echo $row2['link'].'<br>'; echo '<font size=2>'; echo '('; echo $row2['type']; echo ')'; echo '</td>'; } while ($x < 5) { echo '<td> </td>'; $x++; } echo '</tr>'; The part to fill out the row should be necessary with any implementation to keep your html "proper".
  5. http://www.php.net/getimagesize http://www.php.net/imagesx http://www.php.net/imagesy
  6. Try using a different method for detecting if the post has been submitted: if ($_POST['sb1'] == "Submit") { // Do your login stuff }
  7. Yes, a "cron job" is a task that a *nix OS executes at periodic intervals. In windows it's called a "scheduled task". Yes, but you will also want to put the path to the executeable. a very simple example: * * * * * /path/to/php/binary /path/to/php/script Write your code for the command line. http://www.php.net/command_line Although, I have seen people use wget to execute a script as though it was a web script, rather than command line. As far as I know, you can have unlimited.
  8. I prefer the modulus method: $x = 0; echo '<tr>'; while($row2 = mysql_fetch_assoc($new_games)){ if ($x % 5 == 0) { echo '</tr><tr>'; } $x++; echo '<td>'; echo'<center>'; echo '<font size=3>'; echo '<img src="gamepic/'; echo $row2['game_picture_url']; echo '" height="120" width="120"><br>'; echo $row2['link'].'<br>'; echo '<font size=2>'; echo '('; echo $row2['type']; echo ')'; echo '</td>'; } However, there are, of course, many others.
  9. are you outputting anything to the browser before you start your "download" headers? Common "errors" are a blank line at the end of an included file (or the top of your page): <-- this blank will cause the file download to be weird <?php // some php code ?> <-- a space here will throw it off as well, but usually only for included files <-- same with a blank line here If you have any echo or print statements, those count to. As well as anytime you escape and reenter php, e.g.: <?php //some code ?> <-- this is a "newline" being sent to the browser <?php //some more code ?> Some say that just doing "?><?php" in your script, with no space or anything else between them will cause header errors...I haven't tested that though. The reason that you are seeing "uncompiled code" in your browser is because when some form of output is sent to the browser before the headers you are specifying the browser automatically sees it as being "text/html" (or something like that). Sending different headers ("application/zip") doesn't change that, so the browser continues to interpret the data it's receiving as text.
  10. Unless you have a VERY good reason for using text as the data type for an item identifier change it to a VARCHAR that is acceptably long. Using TEXT will kill performance as the table gets larger and use increases. Not to mention if you have an index on that field (and you probably should since you are using it in your where clause and it's a product identifier) the index for a TEXT field will be huge.
  11. What data type is item_numb in the database? If it is anything other than int, then you need to have single quotes around your variable: $query .= " where merchant=$merchadmin and item_numb='$item_numb'"; If it is an int, then you shouldn't be letting the user submit alphanumeric values.
  12. You can use mysql_data_seek to change the starting row. http://www.php.net/mysql_data_seek // I'm assuming that $result has > 10 rows mysql_data_seek($result, 2); // the result set starts @ 0, so 2 == the third row // print results 3 - 7 for ($x = 3; $x <= 7; $x++) { $row = mysql_fetch_assoc($result); print_r($row); } mysql_data_seek($result, 0); // move back to the first result //print the first 3 results. for ($x = 0; $x <= 2; $x++) { $row = mysql_fetch_assoc($result); print_r($row); }
  13. What are the names of the photo's you are trying to display? What are the differences between the ones that do display, and the ones that don't? Most likely, the ones that don't display have some sort of character that is being "urlized" (space = "%20", etc.). Use urldecode to remove the characters that are being changed. http://www.php.net/urldecode
  14. A gif can only have 256 colors. Use a jpg or png if you need more.
  15. I'm assuming you want to loop through the rows of your mysql result set...you're not very clear. while ($row = mysql_fetch_assoc($result)) { echo $row['ext_url']; } The easiest way to loop through only rows 3-7 is to only select those rows from your database. Reformat your query to better select your data, or use a limit on the end of your select statement. There are other methods, but using SQL to select out only the data you want is the best in my opinion.
  16. At best, that would be redundant...at worst, it would throw an error. Echo out your variables and make sure they are values that you are expecting. You may be getting an invalid value.
  17. use the explode command... http://www.php.net/explode $animals = explode(", ", $_POST['animals']);
  18. Show the mysql error and see what you get... change: $rsUpdate = mysql_query($sqlUpdate,$conn); to $rsUpdate = mysql_query($sqlUpdate,$conn) or die(mysql_error());
  19. the file command will read the page into an array with a numeric key. You can use that to echo out a specific line...just remember that the key will start at 0. http://www.php.net/file $url = "www.google.com"; $line = 10; $web_page = file($url); echo "Line " . $line . " of page " . $url . " is:\n" . $web_page[$line - 1];
  20. $input = 'VERDRM'; $input2 = 'VERDRM<'; $pattern = '/^[A-Za-z0-9]+$/'; if (!preg_match($pattern, $input)) { echo "ERROR: " . $input . " is not a valid value"; } if (!preg_match($pattern, $input2)) { echo "ERROR: " . $input2 . " is not a valid value"; }
  21. // these don't need to be reassigned each time since they are arrays. $art_headline = $_POST['art_headline']; $art_txt = $_POST['art_txt']; $art_trunc = $_POST['art_trunc']; $art_rm = $_POST['art_rm']; $art_img = $_POST['art_img']; for($i = 1; $i <= count($_POST['art_headline']); $i++) { $query = " INSERT INTO {$database}.newsletter_articles ( art_nl_id, art_article_num, art_headline, art_txt, art_trunc, art_rm,art_img ) VALUES ( '{$newid}', // Where is this coming from? '{$i}', '{$art_headline[$i - 1]}', '{$art_txt[$i - 1]}', '{$art_trunc[$i - 1]}', '{$art_rm[$i - 1]}', '{$art_img[$i - 1]}' )"; $sql = mysql_query($query) or die(sql_error('could not INSERT INTO {$database}.newsletter_articles table')); echo $query . "<br />"; }
  22. You can also try ini_set, although I'm not entirely sure it will work with both directives.
  23. They shouldn't matter unless they are passed as a string...e.g. : $var['04'] != $var[04]
×
×
  • 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.