-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
i would assume $myArray['PatientName'] =$dicom->PatientName;
-
If i have read this correctly then you have some category and they in turn have sub-category, for example CatA --SubCat1 --SubCat2 --SubCat3 CatB --SubCat4 --SubCat5 --SubCat6 Now for example you want UserA that belongs to CatA and UserB who belong to SubCat2 & SubCat5 & SubCat6 Now if you have a table like this categories ID Name ParentID 1 CatA 0 2 CatB 0 3 SubCat1 1 4 SubCat2 1 5 SubCat3 1 6 SubCat4 2 7 SubCat5 2 8 SubCat6 2 Users ID Name CatID 1 UserA 1 1 UserB ??? Can you can do is create another table called UserCats UserCats ID UserID CatID 1 1 1 2 2 4 3 2 7 4 2 8 Now you can get all the Cats like this SELECT categories.Name FROM UserCats LEFT JOIN categories ON categories.ID = UserCats.CatID WHERE UserCats.UserID = 2 Hope that helps.. or did i miss the whole point ?
-
It maybe easier to read the file into an array, then concatenate it back to a string for example <?php $myfile = 'myFile.txt'; $lines = file($myfile); if(isset($_GET['Remove'])){ //remove line unset($lines[$_GET['Remove']]); //save file file_put_contents($myfile, implode("/n",$lines)); } if(isset($_GET['add'])){ //add line $lines[] = "this is a new line"; //save file file_put_contents($myfile, implode("/n",$lines)); } //display file foreach ($lines as $line_num => $line) { echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "[<a href='?Remove={$line_num}'>Remove</a>] [<a href='?add=true'>Add</a>]<br />\n"; } Edit: fixed a typo EDIT: just added "add line" your get what i mean
-
An EAN13 Bar-code is in fact 13 digits, BUT the last digit is a checksum, so only 12 digits are need to generate the bar-code, As for what your attempting to do, it's quite unclear! Bar-code are shouldn't contain "random number" and EAN13 has 12 usable digits, so that's a trillion bar-codes you can use!
-
So this then echo date('D, d M Y G:i:s O',strtotime($ISO8601));
-
that's what you wanted right ?
-
Help with horrible coding woes (the mythical unexpected T_ENDIF)
MadTechie replied to thurfjell's topic in PHP Coding Help
looks like your missing <?php endwhile; ?> above the endif -
ISO-8601 is support and so is 822 so this should work $ISO8601 = "2005-08-15T15:52:01+0000"; //DATE_ISO8601 echo date(DATE_RFC822,strtotime($ISO8601));
-
Well that code isn't secure either, personally I escape per query however if your happy with it you can simply update to this function recursive_escape(&$value) { if (is_array($value)){ array_map('recursive_escape', $value); }else{ $value = mysql_real_escape_string($value); } } array_map('recursive_escape', $_POST);
-
if you want you can just set it session_start(); $amano = (int)$_POST['amano']; $_SESSION['amano'] = $amano; echo "Pageviews = $amano";
-
sounds correct this is the basic idea <form method="post" action=""> Server: <input type="text" name="MySQL[server]" /><br /> Database: <input type="text" name="MySQL[Databaser]" /><br /> <input type="submit" name="send" value="send" /><br /> </form> <?php echo $_POST['MySQL']['Server']; echo $_POST['MySQL']['Databaser'];
-
First of all $_SESSION['amano'] = '$amano'; // will set the session to the acual word $amano you should do this $_SESSION['amano'] = $_POST['amano']; to set it if its a number then do this to make sure it IS a number $_SESSION['amano'] = (int)$_POST['amano'];
-
of course you could run them both but changing all the $newText to $text
-
$text = 'this is a test to remove URLs from text, the request was made by etrader on http://www.phpfreaks.com under the post http://www.phpfreaks.com/forums/php-coding-help/deleting-urls-from-a-string/?madeup=me Now the second one will not remove items like phpfreaks.com as it must start with http or www. or ftp. but the fire example looks for the ending like .com tests http://domain.com <--Removed http://www.domain.com <--Removed http://domain.com?test=123 <--Removed www.domain.com <--Removed'; //Option1 a- a simple example (your need to add to the domain ie .asia etc) //remove words ending with .com etc $newText= preg_replace('/\b[\S]*\.(?:co\.uk|com|net|org)\S*/i', '', $text ); //Option 2 (won't remove ones without either www. or http) //remove words starting with www. or http (and uses a RFC 3986 standard) $newText= preg_replace('/\b(?:https?:\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/i', '', $text); echo $newText;
-
use stripslashes, but ideally turn off magic quotes in your PHP.ini file
-
I don't know what the function would be called it was just an example! i'll need to see the code if you don't know the fuction then you could just echo the html, ie <?php echo tep_hide_session_id(); echo '<input type="submit" value="Submit">'; echo '</form>';?>
-
Whats the problem ? but it looks like your missing a function ie echo tep_hide_session_id() . ('input type="submit"','value="Submit"') something like echo tep_hide_session_id() . tep_draw_button('input type="submit"','value="Submit"')
-
if its static use <href="localhost/xampp/abc.php?cat=whatever"> but you could use the same idea via a JS link in abc.php to get the categorie use the $_GET ie echo $_GET['cat']; [/code]
-
make sure the other code is in a PHP file (with the php extension)
-
The PDF that was received by the clients email, try adding this after $file = $path.$filename; add if(!file_exists($file)){ echo "File not Found"; return false; }
-
HELP: Copying Files using results from a DB
MadTechie replied to Skipjackrick's topic in PHP Coding Help
//now move files $file = './submitted_pics/'.$galleryresults[0]['image']; //fixed $newfile = './images/' .$userId. '/'.$galleryresults[0]['image']}; //fixed //Use rename to "move" instead of copy if (!rename($file, $newfile)) { -
looks find to me.. what do you mean it failed! what actually happened ? Error message ?
-
didn't i say that ? oh i did!
-
move $target_path under uploadedfile2 and change to $target_path = $target_path . $uploadedfile2;
-
Well a COMET server rebuild the page (unless I am mistaken) the problem is apache is being sent nothing and waiting for output try this add to the start ini_set("output_buffering","Off"); ini_set("zlib.output_compression","Off"); //Loop while(! ($row = getNewMessagesSince($_POST['lastupdate']))) { //every half a second usleep(50000); echo ""; //Yes echo nothing.. flush(); // and output } Sounds strange but may just keep apache alive and in turn keep the browser pinging