Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. use a header: [code]header("location: user_level1.php");[/code] Or you can ouput a meta refresh tag to the browser, or a javascript redirect to the browser.
  2. Use the "SHOW COLUMNS FROM tablename" MySQL query, then loop through the result and look at the Type column. http://dev.mysql.com/doc/refman/5.0/en/show-columns.html
  3. Keep your code the same as in your first post, but change: [code]$numrows = mysql_fetch_row($res);[/code] to: [code]$numrows = mysql_result($res, 0);[/code] http://www.php.net/mysql_result
  4. Use an if statement.... [code]if ($_GET['affcode'] && is_numeric($_GET['affcode']) {   echo 'Welcome Affiliate!!'; } else {   echo 'Welcome Guest'; }[/code] Simplistic, but you get the point. Here's a tutorial on creating a membership system: http://www.phpfreaks.com/tutorials/40/0.php
  5. You don't need a class for this...in fact, you only need a couple of commands.... http://www.php.net/setcookie to set your cookie http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.cookies  for information about getting info from the cookie http://www.php.net/serialize and http://www.php.net/unserialize for storing arrays in your cookie. That's pretty much it.
  6. [quote]select selected_id from table2 where 1[/quote] That isn't a valid sql query.  Aside from your subselect being jacked, it should work. [code]SELECT * FROM table1 WHERE members_id NOT IN (SELECT selected_id FROM table2);[/code]
  7. If you do not do something with the file on the page that it is uploaded to, you will not have access to it.  When you upload the file it is kept in the location specified by $_FILES['uploadFile']['tmp_name'], however, when the script is done processing, that file is removed.  Therefor, you must use move_uploaded_file or another function to save the file permanently. Change your form so it submits directly to action="upload", eliminating the intermediate action="fghgf".
  8. To get rid of the .mp3 [code]echo "$spaces <a href='$path/$file'>" . str_replace(".mp3","",$file) . "</a><br />";[/code] Directories are listed in the same order as if you did "dir" or "ls -l", they may seem to be out of order do to capital and lower case initial letters being treated differently.
  9. The manual very clearly states: [quote]<!-- The data encoding type, enctype, MUST be specified as below --> <form enctype="multipart/form-data" action="__URL__" method="POST">     <!-- MAX_FILE_SIZE must precede the file input field -->     <input type="hidden" name="MAX_FILE_SIZE" value="30000" />     <!-- Name of input element determines name in $_FILES array -->     Send this file: <input name="userfile" type="file" />     <input type="submit" value="Send File" /> </form>[/quote] http://us3.php.net/manual/en/features.file-upload.php
  10. change: [code]$friends_count = mysql_fetch_array($friends_query);[/code] to [code]$friends_count = mysql_result($friends_query, 0);[/code] http://www.php.net/mysql_result
  11. [quote]Thanks, but I have no idea how to make sessions or putting data in cookies[/quote] Refer to the manual for sessions...http://www.php.net/sessions To keep data in a cookie, write it on small strips of paper and mix it into the dough.  You may also want to lower the oven temp to keep the paper from burning.  (http://www.php.net/setcookie)
  12. [quote]Are variables supposed to open ONLY on the page that the data is assisgned to a variable?[/quote] Yes.  PHP does not run constantly like a C or C++ program.  It executes the page, then it stops, which kills all variables.  You can have some variables persist by putting them into the session, or using cookies. The exception to this is if you are writing a program for php-gtk...but then it's closer to writing a C program than a web app.
  13. Why has this question been asked so many times lately?  This is the third or fourth time I've seen it in the same number of days. Anyway, no.  Why do you want to send to multiple pages?  Create one page that does all of your processing.  If you need to send data to another page, for payment information or some such, use cURL (http://www.php.net/curl) or sockets (http://www.php.net/fsockopen).
  14. Would any javascript work if the user has javascript disabled?
  15. From http://www.php.net/mysqli [quote]In order to have these functions available, you must compile PHP with support for the mysqli extension.[/quote] Are you sure that your host has the mysqli functions?
  16. You could also use javascript: [code]echo '<script type="text/javascript">window.location.href = "somepage.php";</script>';[/code]
  17. GeSHi is often used for this: http://qbnz.com/highlighter/index.php
  18. Make sure the classfile is included, then you should be able to do... [code]$enc_pass = Htpasswd::cryptPass($user_password);[/code] or [code]$htpasswd = new Htpasswd; $htpasswd ->cryptPass($user_password);[/code] Depending on your version of php.
  19. Or use Barand's script, BaaSelect. http://members.aol.com/barryaandrew/baaselect/baaselectguide.html
  20. [quote]note that if you use multiple dbs you'll need to call access_db for each one prior to querying.[/quote] Everytime you call that function would create a new connection to the database, which can be very taxing on resources.  If you need to use multiple databases, and don't want to specify the database in the query, then just use the mysql_select_db function again to change databases using the same connection.
  21. It makes no difference, unless you are working with multiple databases, then it is much easier to do the latter.
  22. change this: [code]$result4 = mysql_query("SELECT * FROM users WHERE username='$fromname'"); while($r4=mysql_fetch_array($result4)) {   $toid=$r4["toid"]; }[/code] to: [code]$result4 = mysql_query("SELECT * FROM users WHERE username='$fromname'") or die(mysql_error());   $toid = mysql_result($result4, 0, "toid");[/code] See if you are getting an error on your toid query.  Also, echo out your $insert query to see what it looks like...see if the vars are being input or not.
  23. [quote]what does '".$_POST[$i."1"]."' hold is it array type value?[/quote] It is an array element.  It can hold any number of things, but it would appear in your case to most likely be either a string or number.
  24. Try this: [code]<?php include("include/session.php"); if(isset($_POST['submit'])){ $propID = $_GET['propID']; $imageID = $_POST['imageID']; $image_desc = $_POST['image_desc']; mysql_connect(DB_SERVER,DB_USER,DB_PASS); mysql_select_db(DB_NAME) or die( "Unable to select database"); $update = "update images set image_desc = '$image_desc' where imageID = '$imageID' and  prop_ID = '$propID'"; $update_result = mysql_query($update); } $propID = $_GET['propID']; mysql_connect(DB_SERVER,DB_USER,DB_PASS); mysql_select_db(DB_NAME) or die( "Unable to select database"); $query = "SELECT * FROM images, propdata WHERE images.prop_ID =$propID AND propdata.prop_ID =$propID"; $result = mysql_query($query) or die(mysql_error(); $num = mysql_num_rows($result); define('PROP_PICS_PATH', '../property_pics'); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $html .= ' <form name="form1" method="post" action="'.$_SERVER['PHP_SELF'].'?propID=' . $propID . '"> <input type = "hidden" name="imageID" value ="' . $row['imageID'] . '"> <input type = "hidden" name="prop_ID" value ="' . $propID . '"> <table width="100%" border="1" cellpadding="5" bgcolor="#F5F5F5"> <tr> <td width="1"><img src="' . PROP_PICS_PATH . '/' . $row['image_name'] . '"/><br></td> <td> Image Description: <input type="text" name="image_desc" value ="' . $row['image_desc'] . '"><br> Remove image from database <input type="checkbox" name="deletePic" value="1"> </td> </tr> <tr> <td colspan = "3" align = "right"><input type="submit" name ="submit" id="submit" value="Update"></td> </tr> </table> </form>'; } ?> <table width="770" border="1" cellspacing="0" cellpadding="5">   <tr>     <td> <? if($num > 0){ $street = mysql_result($result,0,"street"); $city_state_zip = mysql_result($result,0,"city_state_zip"); $MLS_num = mysql_result($result,0,"MLS_num"); }else{ echo("There are no pictures uploaded for this property.<br>"); echo("anything?".$propID); echo('<a href = "javascript:history.back()">Back to Properties</a>'); } ?> <table> <tr> <td> <? echo($street);?><br> <? echo($city_state_zip);?><br> <? echo("MLS Number: ".$MLS_num);?> </td> </tr> </table> <?php echo $html; ?> <table> <tr> <td> <? if($num>0){ echo('<a href = "javascript:history.back()">Back to Properties</a>'); } ?> </td> </tr> </table> </td>   </tr> </table>[/code]
  25. Just make sure that you always have your date in that format or it won't work.  You should also add in a check to make sure that the later date is set to $enddate, otherwise you will get strange numbers.
×
×
  • 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.