sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
try[code]<?php $flds2 = array('pname','use','job','edate','sdate'); $flds2a = array('event','userid','event_type','event_finish','received'); $f = array_combine($flds2,$flds2a); // your code // ... foreach ($f as $key => $value) { if (trim(stripslashes($_POST[$key][$i])) != '') $qtmp[] = $value . " = '" . mysql_escape_string(trim(stripslashes($_POST[$key][$i]))) . "'"; // etc. } ?>[/code]
-
try[code]<?php $testing = "echo \"hello\";"; $b = "eval(\$testing);"; echo '$b is: ',$b,"\n"; eval($b); echo "\n<br />\n";// or $c ='eval($testing);'; eval($c); ?>[/code]
-
look natsort() function
-
PHP to create a word document with page breaks
sasa replied to WordChocolate's topic in PHP Coding Help
[code]$content.=<br style='page-break-before:always'>; // PAGE BREAK[/code] -
statement '$a != 1 or $a != 2' is allways true!! I think thet you want (ALLOW == $_SERVER["HTTP_X_FORWARDED_FOR"]) || (ALLOW == "All") or (ALLOW != $_SERVER["HTTP_X_FORWARDED_FOR"]) && (ALLOW != "All")
-
how to comment out an apostrophy in an sql statement
sasa replied to paul2463's topic in PHP Coding Help
try[code]<?php $a = "it's best Mark's work"; echo $a,"<hr>\n"; $a = addslashes($a); $sql = "... blah = '$a' and ..."; echo $sql; ?>[/code] -
try[code]<?php $test ='bla bla text bla bla <yo> 1st texr <yo2> bla bla textbla bla text bla bla <yo> 2nd text <yo2> bla bla textbla bla text bla bla <yo> 3rd text <yo2> bla bla text'; $a = preg_split('/<yo>/',$test); for ($i = 1; $i < count($a); $i++) { $b = preg_split('/<yo2>/',$a[$i]); $c[] = $b[0]; } print_r($c); ?>[/code]
-
try[code]print_r($_POST); //just for testing purposes only if (isset($_POST['pricing']) // < == change this line { $pricing = $_POST['pricing']; } else { echo "Please fill out form above to get results below<BR>"; }[/code]
-
[code][codegecho "<select name='newName'>"; echo "<option value='1' selected>Select a Catagory</option>"; echo "<option value=\"cat".$row['itemCat']."\">".$row['itemCat']."</option>\n"; //<= this is extra line remove it $result = mysql_query("SELECT itemCat FROM `products`"); while($row = mysql_fetch_array($result)) { echo "<option value=\"".$row['itemCat']."\">".$row['itemCat']."</option>\n"; } echo "</select>"; echo " <input type='submit' name='submitfour' value='Submit' /> ";[/code]
-
try[code]SELECT COUNT(*) as num, SUM(a_30days='1') as num1 FROM a[/code]
-
try[code]<?php $dirname = "./files"; $dh = opendir($dirname) or die("couldn't open directory"); while ($file = readdir($dh)) { if ($file != '.' && $file != '..' && $file != ".htaccess") { $fcon=file("$dirname/$file"); $fh=fopen("$dirname/$file ", 'w'); foreach ($fcon as $fline) { $fline = explode('|', $fline); $fline[5]=0; $fline = implode('|', $fline); fputs($fh, $fline); } fclose($fh); } } echo "ok!"; ?>[/code]
-
Multi-Select Transfer Box + Javascript + PHP + MySQL
sasa replied to CaptainSlow's topic in PHP Coding Help
The id attribute, like most other HTML 4.0 standard tags, lets you attach a unique string label to the form control and its contents for reference by programs (applets) and hyperlinks. This name is distinct from the name assigned to a control element with the name attribute. Names assigned with the id attribute are not passed to the server when the form is processed. The ID attribute takes precedence over the name attribute, so if you have both an ID and name attribute defined inside a form field, the script will use the ID attribute to uniquely identify this field. -
how would i use html tags to format the below code :s
sasa replied to wesleypipes's topic in PHP Coding Help
btw statement '$hours >= 22 && $hours <= 3' is newer true -
Multi-Select Transfer Box + Javascript + PHP + MySQL
sasa replied to CaptainSlow's topic in PHP Coding Help
change[code]<SELECT NAME="chosen" SIZE="4"[/code] to [code]<SELECT NAME="chosen[]" id="chosen" SIZE="4"[/code] -
try[code]<? $query = "SELECT * FROM *** ORDER BY *** DESC LIMIT 50"; $result = mysql_query($query); $num = mysql_numrows($result); mysql_close(); $i = 0; $count = 0; echo '<table>'; while ($i < $num) { $buid=mysql_result($result,$i,"buid"); $ltitle=mysql_result($result,$i,"ltitle"); $ldesc=mysql_result($result,$i,"ldesc"); $url=mysql_result($result,$i,"url"); $price=mysql_result($result,$i,"price"); $i++; if (!$count) echo '<tr align="center">'; ?> <td><a href="<? echo "$url"; ?>" Alt="<? echo "$ltitle"; ?>"><? echo "$ltitle"; ?></a><br><? echo "$ldesc"; ?><br><b>£ <? echo "$price" ?></td> <? if (++$count == 5) { echo '</tr>'; $count = 0; } } if($count) { while ($count++ < 5) echo '<td> </td>'; echo '</tr>'; } ?> </table>[/code]
-
ans2[code]<?php function MyCount($a) { if (is_array($a)) { $out = 0; foreach ($a as $b) $out += MyCount($b); return $out; } else return 1; } $a = array ( array (1,2,3,4,5, array(1,5,9) ), array (6,7,8), array (9,0) ); echo MyCount($a); ?>[/code]
-
[quote author=balkan7 link=topic=113348.msg460630#msg460630 date=1162313336] [code]<td><input type='hidden' name='sifra'></td>[/code] its hidden for auto generate KEY whit 5 charters in date base. [/quote]it is nothing. you post variable sifra with no value you generate $sifra after in code and it is OK in http://www.phpfreaks.com/forums/index.php/topic,113339.0.html i see '`sifra` INT(25) NOT NULL,' you can not store string in that field [code] <tr> <td><hr /></td> </tr> "; } } //insert this break; //------------------------------------------ //default case, this is shown default //in this instance, we are going to make the default case show //all the categories that you can view tutorials on //------------------------------------------[/code]and[code] "; } } break; } // } <= remove this //end navigation //------------------------------------------[/code]
-
in table software field sifra is int type (your previous post)
-
declare obsdian's function and use print(getInitials($row->pat_first_name));
-
[code] while ($row = mysql_fetch_array($result)) { // Now we need to add rows and coloums to the database if($i == 0) print ('<tr>'); // open a new coloum $i++; //while ($i <= $rows)// print results as many times as there is rows printf('<td><a href="%s?cat=%s">%s</a></td>', $_SERVER['PHP_SELF'],$row['catID'], $row['Name']); //$i++; if($i == $rows) { print ('</tr>'); // close the coloum $i = 0; } } [/code]
-
[code]<html> <head> <script language="JavaScript1.3" > <!-- var count = 0; function row(){ count = count +1; var table=window.document.getElementById("table1"); var newRow = document.createElement("tr"); newRow.id = 'row'+count; var newCell=newRow.appendChild(document.createElement("td")); for (var i=0;i<5;i++){ var input=newCell.appendChild(document.createElement("input")); input.type="text"; input.name="frend["+count+"][]";} var a = newCell.appendChild(document.createElement("a")); a.href="javascript:moveRow("+count+")"; a.innerHTML ='Remove row'; table.appendChild(newRow); } function moveRow(i) { var row = document.getElementById("row"+i); row.parentNode.removeChild(row); } --> </script> </head> <body> <?php if ($_POST) { //for ($x=0;$x<5;$x++) $c["cell".$x]=$_POST['cell'.$x]; print "<pre>"; print_r($_POST); print "</pre>"; } ?> <form method="POST" action=""> <input type="button" value="AdRow" onclick="row()"> <input type="submit"><br /> <table id="table1" border="3px" width="80%" align="left" > <tr> <td width="20%" align="center">FREND</td> </tr> </table><br /> </form> </body> [/code]
-
try[code]<?php $userid =1; $usernameid = 5; $a ='<a href="index.php?logout=$userid" target="_parent" >Logout $usernameid </a>'; eval('$a = "'.addslashes($a).'";'); echo $a; ?>[/code]
-
try[code]<form method=post> <input type=hidden name="form_action" value="addQuickQuote"> <table cellspacing=0 cellpadding=0 width=90% border=1> <?php //list members require_once("includes/class.member.php"); $objMember=new Member(); $arrMemberList=$objMember->getMembers("on"); if(count($arrMemberList)==0) echo "No activated members were found.<br>"; else{ ?> <tr> <td>Select Member</td> <td> <select name=member_id class=fieldbox> <?php while($member=array_pop($arrMemberList)){ echo "<option value='".$member["id"]."'>".$member["username"]."\n"; } ?> </select> </td> <td> or Enter Member name:<input type="text" name="UserName" /> </td> </tr> <?php } ?> <tr> <td>Contact name</td> <td colspan="2"> <INPUT size=19 name="contact_name" type=text class=fieldbox> </td> </tr> <tr> <td>Group</td> <td colspan="2"> <select name=group_id class=fieldbox> <?php while($group=array_pop($groups)){ echo "<option value='".$group["id"]."'>".$group["groupname"]."\n"; } ?> </select> </td> </tr> <tr> <td>Reference Name</td> <td colspan="2"> <INPUT size=19 name="ref_num" type=text class=fieldbox> </td> </tr> <tr> <td colspan="3" align=center><input type=submit value="Add Quick Quote" class=fieldbox></td> </tr> </table> </form>[/code]
-
you have problems with your form can we see form code
-
is it type of field 'uStrength' float or integer?