-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
[SOLVED] The specification of the good code
MadTechie replied to omarh2005's topic in PHP Coding Help
no idea its hard to read as you didn't use the code tag(#) OK after a quick look $lenght isn't needed (use count), and $error,$succ i would handle on the returned page so replace the header with return true/false and on the return redirect of course the script can be improved that just after a quick review and that my personal view function fun_add($tab,$id,$iman,$lenght,$error,$succ) { if ($id==0){//its insert function ! $res=("insert into $tab ()values()"); mysql_query($res); $id=mysql_insert_id(); }//end if // Get table Info $res1=mysql_query("desc $tab "); $c=0; while ($row1=mysql_fetch_array($res1)){ $c=$c+1; $fname[$c]= $row1[0]; } //2 to the first field acept id $q="update $tab set "; for ($i=0; $i<$lenght ; $i++) { $fi=$i+2; $q.="$fname[$fi]= '".$iman[$i]."' "; if($i!=$lenght-1) $q.=","; } $q.=" where id = '".$id."'"; //print $q; mysql_query($q) or die("not query"); if ( mysql_affected_rows()>0) { header("location:"."$succ"); exit; } else { header("location:"."$error"); exit; } } //$iman =array("hi","iman",125,"wo"); //iman_add("test",2,$iman,4,"error.php?a=1","view.php"); -
try this <?php echo "<td width='30'><form name='editdetails' action='editpage/"; echo "$editpage" ; echo "' method='POST'><input type='hidden' name='login' value='" . $row['login'] . "'><input type='submit' class='main' name='Submit' value='Edit' /></form></td>"; ?> you need the quote the value
-
what about this, to filter the html.. you could replace "good tags" with [] then filter then replace back ie <B> replace with [b] filter [b] replace with <B> $html= preg_replace('%<(/?B)>%sim', '[$1]', $html); html = "<html> <body> test <script>"; $html = preg_replace('%<[a-zA-Z/][^>]*>%sim', '', $html); $html= preg_replace('%\[(/B)\]%sim', '<$1>', $html);
-
this should be in Third Party, should have code tag, and i'm not sure what your asking
-
Ahh ok, so you got it ? it helps to see a few matches and invalid matches.. if this is solved then please click topic solved
-
post some code so i can see what your doing
-
[SOLVED] The specification of the good code
MadTechie replied to omarh2005's topic in PHP Coding Help
Use only the functions you need to per site but if a function seams to have "too many" parameters it should "probably" be setup as a class and/to be broken down into smaller functions. -
$text_line = explode(":" , $line); $X = count($text_line); //<--$X will be the columns so for the whole file $X = 0; $lines='db.txt'; foreach ($lines as $line) { $text_line = explode(":" , $line); $X = $X+ count($text_line); } echo "$X: columns ";
-
[SOLVED] variabile into a variabile to other
MadTechie replied to soryn4u's topic in PHP Coding Help
a.php ----------- <?php $a = 'dog'; ?> b.php ----------- <?php include "a.php"; $b = $a; echo $b; ?> -
what about this preg_match("/\$Lock\s\w+\sPk=\w+\|/", $lock, $matches)
-
Welcome to the board.. erm.. "this thing become horrible" isn't the most detailed question.. can you re-phrase, also a link to a member with a wish list may help
-
use $field = urldecode($_GET['field']); to resolve the encoding issule urldecode or use post
-
welcome please click topic solved (bottom left) and welcome to the board
-
we looking for a random error or if their is an error or what? more details not all of us can read minds (not at this distance anyway) would be nice if you closed the else statement or the first if..
-
[SOLVED] % Progress Bar during server-side query
MadTechie replied to Fearpig's topic in PHP Coding Help
Animated gif would be better then as with a processbar percent your need to know how long the way i work it out is something like this 1. get the current time = StartTime 2. get the number or items/records etc = R, 3. during the processing, after echo records, i do RT = Total Records RP = Records processed so far PerRecord = ((Current Time - StartTime) / RP) TimeRemaining = ((RT - RP) * PerRecord) i hope that makes sense but -
Create new file <?php phpinfo(); ?> save here C:\xampp\htdocs\phpinfo.php now load this link http://localhost/phpinfo.php whats displayed
-
you can have some of my spam if you like, i have loads LOL
-
1. Wrong section 2. check the URL (If you entered the URL manually please check your spelling and try again.) this isn't a PHP problem
-
[SOLVED] The specification of the good code
MadTechie replied to omarh2005's topic in PHP Coding Help
erm.. really depends what the code is for? heres some Expandability Upgradeability Flexibility Useability but really we need a more detailed question and in the correct section (this isn't a PHP problem) -
Try this <?php mysql_query($query) or die ("Er is een fout opgetreden tijdens het registreren van de ingevoerde gegevens"); //--Snip $email_from = "webmaster@gebr-sluijer.nl"; $onderwerp = "Rally-online account activatie"; $mime_boundary = "----Rally-online----".md5(time()); $headers = "From: Rally-online <$email_from>\n"; $headers .= "Reply-To: Rally-online <$email_from>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n"; $url = "http://www.gebr-sluijer.nl/test/"; $bericht = "Beste rally-online gebruiker\nUw activatie link: <a href='$url'>here</a>"; ini_set("sendmail_from", $email_from); //---End Snip if(mail($email, $onderwerp, $bericht, $headers) == true) { ?> PS the only stupid questions is the unasked one EDIT: if this fails comment out the $URL line change $url = "http://www.gebr-sluijer.nl/test/"; to //$url = "http://www.gebr-sluijer.nl/test/"; and try that, (just need to know the patten)
-
i have commented out the lines //$VariableName = $_GET['VariablePassed']; //$sql = 'SELECT * FROM `Booking Database` ORDER BY `Booking Database` . `Price Cat` ASC LIMIT 0, 30'; and replaced them with $Acat = $_GET['Acat ']; //Acat being the form element name were passing $sql = 'SELECT * FROM `Booking Database` ORDER BY `Price Cat` WHERE `Price Cat` = $Acat LIMIT 0, 30'; Basically the 'Acat' is the element in the form (thus the new GET) and i am selecting the records where `Price Cat` = $Acat (field `Price Cat` = the value of the Acat field)