-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Short of "data still not appear" can you give some more detail ? heres some things that make help if the form appearing? is the SQL statment correct any errors etc please add others
-
[SOLVED] Returning values problem - please help
MadTechie replied to greg's topic in PHP Coding Help
Heres a quick script to show how i would use it.. Please note i upgraded $HTTP_GET_VARS to $_GET and changed the way sessions are called i also added some emulation to save entering lots of different URLs but it grabs the first one [code?tester.php?products_id=123456789] <?php session_start(); Add(); //Grab First one from URL echo "<br>---<br>"; /*EMULATE START -- remove from live code*/ $_GET['products_id'] = 1; //emulate new entry Add(); echo "<br>---<br>"; $_GET['products_id'] = 2; //emulate new entry Add(); echo "<br>---<br>"; $_GET['products_id'] = 4; //emulate new entry Add(); echo "<br>---<br>"; $_GET['products_id'] = 8; //emulate new entry Add(); echo "<br>---<br>"; $_GET['products_id'] = 10; //emulate new entry Add(); echo "<br>---<br>"; $_GET['products_id'] = 20; //emulate new entry Add(); echo "<br>---<br>"; /*EMULATE END*/ $tmp = $_SESSION['recently_viewed']; //remove last item array_pop($_SESSION['recently_viewed']); //create ; delimited string $tmp = implode(";",$tmp); //display string echo $tmp; //reset (comment out to keep them) #unset($_SESSION['recently_viewed']); function Add() { if (!isset($_SESSION['recently_viewed']) ) { //set session as array $_SESSION['recently_viewed'] = array(); } //add to array $_SESSION['recently_viewed'][] = $_GET['products_id']; //remove dups $_SESSION['recently_viewed'] = array_unique($_SESSION['recently_viewed']); echo "Added:->".$_GET['products_id']; } ?> -
it doesn't continue! How would you like them ? It doesn't the function returns when check_extensie($ext) is true.. ( as scripted to do so)
-
your missing $row = mysql_fetch_array($result); add here if ($bil_rekod <= 0) { echo "<br><center><font face='Verdana' color ='blue' size='4' >MAAF, Carian Anda Tidak Berjaya. Kod Siri yang Anda Masukkan Tiada Dalam Pangkalan Data.<br><br>"; } else { $row = mysql_fetch_array($result); //<-------------- ?>
-
[SOLVED] Returning values problem - please help
MadTechie replied to greg's topic in PHP Coding Help
you mean something like this <?php if (!isset($_SESSION['recently_viewed']) ) { //set session as array $_SESSION['recently_viewed'] = array(); } //add to array $_SESSION['recently_viewed'][] = $HTTP_GET_VARS['products_id']; //remove dups $_SESSION['recently_viewed'] = array_unique($_SESSION['recently_viewed']); ?> //remove last item $tmp = array_pop($tmp); //create ; delimited string $tmp = implode(";",$tmp); //display string echo $tmp; -
[SOLVED] Returning values problem - please help
MadTechie replied to greg's topic in PHP Coding Help
hummm.. and the code is ? -
kinda old code but still may help http://www.phpfreaks.com/forums/index.php/topic,155984.0.html
-
okay.. so whats the problem ?
-
Hummm usingstrtotime ? okay what is the field type in the my sql database ?
-
whats the field type ? verify the sql data
-
check the sql statment.. can verify the output.. are you getting the expected results?
-
try this $sql = "SELECT Kod_siri,Nama_item,Tarikh_luput,Kuantiti FROM stok WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) >= Tarikh_luput order by Kod_siri";
-
you mean like this (untested) $conn=mysql_connect('localhost','root',''); mysql_select_db("zns_inventori", $conn); if (!empty($_POST['carian'])){ $carian = $_POST['carian']; $sql = "SELECT * FROM stok where Kod_siri LIKE '%$carian%'"; $result = mysql_query($sql); $bil_rekod = mysql_num_rows($result); if ($bil_rekod <= 0) { echo "<br><center><font face='Verdana' color ='blue' size='4' >MAAF, Carian Anda Tidak Berjaya. No Pendaftaran yang Anda Masukkan Tiada Dalam Pangkalan Data.<br><br>"; } else { while ($row = mysql_fetch_array($result)) { ?> <form id="form1" name="form1" method="post" action=""> <table width="501"> <tr> <td height="37" class="style12">Kod Siri </td> <td class="style12">:</td> <td><label> <input type="text" name="textfield" id="Kod_siri" value="<?php echo($row['Kod_siri'])?>" /> </label></td> </tr> <tr> <td width="176" height="37" class="style12">Nama Produk </td> <td width="18" class="style12">:</td> <td width="285"><input type="text" name="textfield2" id="Nama_item" value="<?php echo($row['Nama_item'])?>" /></td> </tr> <tr> <td height="36" class="style12">Kategori Produk </td> <td class="style12">:</td> <td><input type="text" name="textfield3" id="Jenis_item" value="<?php echo($row['Jenis_item'])?>" /></td> </tr> <tr> <td height="33" class="style12">Kuantiti</td> <td class="style12">:</td> <td><input type="text" name="textfield4" id="Kuantiti" value="<?php echo($row['Kuantiti'])?>" /></td> </tr> <tr> <td height="40" class="style12">Harga (RM) </td> <td class="style12">:</td> <td><input type="text" name="textfield5" id="Harga" value="<?php echo($row['Harga'])?>" /></td> </tr> </table> </form> <?php } } } ?>
-
well spotted mtylerb, i only looked at the error inquestion lol, but still valid points thats probably all the SQL bugs (unless illogical ones remain)
-
you have 3 Content Type's pick 1 as only the last is really used ie #header('Content-Type: application/force-download'); //force download header('Content-Type: application/octet-stream'); //seam better for IE #header('Content-Type: application/mp3'); // its a MP3 play if possible i have commented out the mp3 and force download see if that makes a differents if not comment the octet and uncommand the force download
-
$query = "SELECT * FROM rock_songs ORDERby id DESC LIMIT $start,$limit"; should be $query = "SELECT * FROM rock_songs ORDER BY id DESC LIMIT $start,$limit";
-
<?php //ob_start(); //commented out echo "Please wait"; ob_flush(); flush(); // now sleep for 5 seconds sleep(5); echo "<br>Done"; ?>
-
Just remove the ob_start(); should do it
-
read up on ob_start / flush on php.net.. thats what your looking for ie <?php ob_start(); echo "Please wait"; ob_flush(); flush(); //long wait... ?> EDIT: Oh yeah.. you should be able to just use flush(); before the long process (or even in steps) that would output the html to the page.. but i have had some problems using just that.. read this UC i worked it out then saw that post.. lol
-
I haven't used gnu mailutils but from what i can tell their are command line based utilites.. so to use them your need to use system(); or exec(); you maybe able to tweak the OS to use them in replacement but its not a simple setting change (well not that i am aware of).. May i ask why ?
-
i guess your have to move onto javascript then try this *untested* function automatic(delay) { document.frames["myframe"].location.href = "frame.php"; document.frames["myframe"].location.reload; setTimeout("automatic("+delay+")", delay); } //<IFrame name="myframe" Src="frame.php" Scrolling=No Frameborder=0 Marginheight=0 Marginwidth=0 Width=120 Height=140>
-
can't you just exec it again! surely that would create another instances !
-
[SOLVED] One php file for multiple FORM processing
MadTechie replied to acctman's topic in PHP Coding Help
well if you have the form names that are different then you could do this <?php if(!isset($_POST['form1'])) { //form 1 stuff } if(!isset($_POST['form2'])) { //form 2 stuff } ?> or you could post to it like this "action='process-edit.php?form1' " and use this <?php if(!isset($_GET['form1'])) { //form 1 stuff } if(!isset($_GET['form2'])) { //form 2 stuff } ?> But their are a few ways those 2 are some of the easiest or even " action='process-edit.php?form=form1' " <?php switch($_GET['form']) { case "form1": //form 1 stuff break; case "form2": //form 2 stuff break; } ?> -
or you could turn off directory listing via .htaccess.. the fact remains if anyone can access the image then anyone can steal the image.. removing the listing makes it a little harder
-
did you remove the last comma & single quote ? me]')','"; can you post the updated code please