Jump to content

mrdamien

Members
  • Posts

    186
  • Joined

  • Last visited

Everything posted by mrdamien

  1. example of str_replace <?php $chars = array("\n", "\r"); $header = str_replace($chars, "", "Location: www.urlexample.com/secure/messe...SuccessPage={$url}"); header($header); ?>
  2. Its something to do with your character set I think. I put <meta http-equiv="content-type" content="text/html; charset=UTF-8"> in a test page with one of your quotes and the "" characters went away.
  3. Posting the section of your code relating to the database insert would be helpful.
  4. Calling the Bait::foo() method like that, is as if your calling a static function. When you use the $this-> method, your calling it from within an instance of the Bait class, so you don't need to include the class name ($this->Bait->foo() bold part.)
  5. Like so? -htdocs/ -htdocs/Jacey/ -htdocs/Jacey/Prod -htdocs/Prod/ then <?php $imageurl = '/Prod/Laptop/' . basename($row['product_image']); ?>
  6. OS X/Windows has nothing to do with the problem. Your browsers rendering engine does. You have to add in the </table> tag after your done looping through the results. } // end while echo "</table>"; } // end if(!isset($cmd))
  7. You're letting them hotlink your images? Yeah that could be the problem. Did you consider offloading the images to other servers like tinypic/photobucket/flickr ?
  8. Your server is fast enough for a couple of websites but not too many. It could also be another website on that server is taking up too many resources. You should ask your web host too see whats going on, or switch hosts :-/
  9. Unless your essay is only 255 characters or less, you'll want to use something bigger. Pick from these:
  10. Could you clear that up? What is it you need help with?
  11. Well, you can 'query' a CSV file per se, but you can find it with regular expressions, or simply by going through each line. $file = file('csv.txt'); foreach($file as $line){ list($id, $name, $addess) = explode(",", $line); if($id == 123){ } }
  12. $id = (int)$_SESSION['customer_id']; $results = mysql_query("INSERT INTO tbl (customerID) VALUES ({$id})"); But.. you'll probably have to be more specific than that.
  13. while($d = mysql_fetch_array($qry_course)) { $coursenames[] = $d['coursename']; // Adds $d['coursename'] into the $coursenames array echo $d['coursename']; } You just need to find out which index for both the $coursenames and $colorList arrays point to your desired values, then your query will just look like this: "UPDATE tbl SET color = '{$colorlist[$colorIndex]}' where course='{$coursenames[$courseIndex]}'"
  14. Well: A) Make sure you added the corresponding fields to your database. B) You need to edit your query to reflect the changes to your new structure. (I.e. add the mname/lname fields/values in your INSERT query); If you post the query/database part that will be more helpful.
  15. GD in PHP is faster for resizing images I think. (Unless its changed recently)
  16. Change to See if that works.
  17. 1. Make sure you specified the right table name. 2. Use mysql_num_rows() to make sure you got some rows returned from your query before you call mysql_fetch_array()
  18. Don't bump so quickly. People will help, it just doesn't come instantly. <?php session_start(); $host = 'localhost'; $user = 'root'; $password = ''; $dbase = 'project'; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); $query= "INSERT INTO list (name,age) VALUES "; for($i=1; $i<8; $i++){ $name = $_POST['name' . $i]; $age = $_POST['age' . $i]; if(strlen($name) > 0){ $values[] = array('name'=>$name, 'age'=>$age); } } foreach($values as $key=>$value){ $query .= "('{$value['name]}', '{$value['age']}')"; if($key != 7){ $query .= ",\n"; } } echo $query; $result = mysql_query($query,$dblink); ?> (Not tested)
  19. <?php $path = "."; $dir_handle = @opendir($path) or die("Unable to open folder"); function list_Pages($pg, $pages){ for($i = 1; $i <= $pages; $i++){ if($i-1 == $pg){ $string .= "<b>{$i}</b>"; }else{ $off = $i-1; $string .= "<a href='index.php?page={$off}'>{$i}</a>"; } } return $string."<br>"; } ?> <form name="form1" method="post" action="gallery_post.php"> <?php while (false !== ($file = readdir($dir_handle))) { if(!in_array($file, array("index.php","..","."))){ //explode to include only images $explodefile = explode(".", $file); if(in_array($explodefile[1], array("jpg","png","gif"))){ $fileList[] = $file; } } } closedir($dir_handle); if(!isset($_GET['page'])){ $page = 0; }else{ $page = $_GET['page']; } $perPage = 10; $from = ($page * $perPage); for($i = $from; $i < $from + $perPage; $i++){ if($fileList[$i] != ""){ echo "<input type='checkbox' name='Files[{$fileList[$i]}]' value='y'>"; echo "<a href='{$fileList[$i]}' target='_blank'>{$fileList[$i]}</a><br />"; } } $pages = ceil(count($fileList) / $perPage); echo list_Pages($page, $pages); if($page > 0){ $prev = $page-1; }else{ $prev = 1; } if($page < $pages){ $next = $page+1; }else{ $next = $pages; } echo "<br><a href='?page={$prev}'>Back 1 page</a> <a href='?page={$next}'>Forward 1 page</a>"; ?> <input name="delete" type="submit" id="delete" value="Delete"> </form> Fixed. (Tested this time.)
  20. Is your browser accepting cookies? Try clearing your cache. Are you sure that the $_POST information is being sent?
  21. Try: setcookie("username", $_POST['username'], $hour); setcookie("Key_JDW", $_POST['pass'], $hour);
  22. Use an absolute path: include ($_SERVER['DOCUMENT_ROOT'] . "/path/to/your/site/includes/file2.php"); include ($_SERVER['DOCUMENT_ROOT'] . "/path/to/your/site/includes/file3.php"); Should work no matter where you include it form.
  23. You should consider using a database for this, since it is much more suited to your needs. But try this: <?php $path = "/"; $dir_handle = @opendir($path) or die("Unable to open folder"); ?> <form name="form1" method="post" action="gallery_post.php"> <?php while (false !== ($file = readdir($dir_handle))) { if($file == "index.php") continue; if($file == ".") continue; if($file == "..") continue; //explode to include only images $explodefile = explode(".", $file); if($explodefile[1] != "jpg" && $explodefile[1] != "gif" && $explodefile[1] != "png") continue; $fileList[] = $file; } closedir($dir_handle); $page = (int)$_GET['page']; $imagesPerPage = 10; for($i = $page*$imagesPerPage; $i < count($fileList) + $imagesPerPage; $i++){ echo "<input type=CHECKBOX name='Files[$fileList[$i]]' value='y'>"; echo "<a href='http://www.mysite.com/$fileList[$i]' target='_blank'>$fileList[$i]</a><br />"; } echo "<a href='?page={$page-1}'>Back 1 page</a> <a href='?page={$page+1}'>Forward 1 page</a>"; ?> <input name="delete" type="submit" id="delete" value="Delete"> </form>
  24. This isn't an "if statement" problem. We don't write whole scripts for you. Here's some pseudo-code to get you started: -Connect to DB server -Select database -Query db: Select row from pp_goods -If pp_goods.feature == "y" --Then echo "some example text" --Else nothing -Disconnect from DB server
  25. You could make your ajax functions by yourself, but try using a javascript library like jquery. Other libraries include (google) mootools / prototype Once you download/include the jquery library do something like this: <script> function myFunction(id){ $.get("page.php", { drink: id }, function(data){ alert("Data Loaded: " + data); }); } </script> <option onchange="myFunction(this.value)"> <select value="1">water</option> <select value="2">soda</option> <select value="3">beer</option> </option> <? #page.php switch($_GET['drink']){ case 1: echo "water is okay"; break; case 2: echo "yay for soda"; break; case 3: echo "nice"; break; } ?> This wasn't tested, but should give you the idea.
×
×
  • 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.