Jump to content

drisate

Members
  • Posts

    805
  • Joined

  • Last visited

Everything posted by drisate

  1. Ya ia m adding +1 to PHPFreaks ;-) Fast support when ever you need some and a very goos and patient comunaty. I pesanly help 5 times for every 1 question i ask.
  2. Then you also need to change the function name in the xml-fonc.php page function xml_to_questiondb($name,$attribs,$content) { if ($content!=""){ $content = explode("<$name>", $content); $content = explode("</$name>", $content[1]); $content[0]=addslashes($content[0]); } if ($name=="Name"){ $enter = mysql_query("INSERT INTO coach (id, name) VALUE ('', '$content[0]')") or die (mysql_error()); }else{ if ($content!=""){ $coach_select = mysql_query("SELECT * FROM coach order by id desc limit 0,1") or die (mysql_error()); $coach = mysql_fetch_array($coach_select); $enter = mysql_query("UPDATE coach SET $name='$content[0]' WHERE id='$coach[id]'") or die (mysql_error()); } } } And of course change for your info
  3. yeah that worked :-) Thanks again bro
  4. maby i should make a new topic...
  5. Let me share you my page per page code <?php $rowsPerPage=10; $table="table"; if ($_GET ==""){$pageNum = 1;}else{$pageNum = $_GET['page'];} $offset = ($pageNum - 1) * $rowsPerPage; $result = mysql_query("SELECT COUNT(id) AS numrows FROM $table $limit_status") or die (mysql_error()); $row = @mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; $re_page = $pageNum*$rowsPerPage; $ree_page = $re_page-$rowsPerPage+1; // Table Start print (""); $result = mysql_query("SELECT * FROM $table $where") or die (mysql_error()); while($data = @mysql_fetch_array($result)) { // Table Middle // Use $data[name] to display stuff print (""); } // Table end print (""); $maxPage = ceil($numrows/$rowsPerPage); $self = "index.php?"; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) { $nav .= " $page "; } else { $nav .= " <a href=\"$self&page=$page\">$page</a> "; } } if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self&page=$page\">[back]</a> "; $first = " <a href=\"$self&page=1\">[First page]</a> "; } else { $prev = ' '; $first = ' '; } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self&page=$page\">[Next]</a> "; $last = " <a href=\"$self&page=$maxPage\">[Last page]</a> "; } else { $next = ' '; $last = ' '; } echo "<p align='center'>($ree_page/$re_page from $numrows) Page:<b>$first $prev $nav $next $last</b></p>"; ?>
  6. hmm i probably did it wroung because i am missing the last value <?php function list_categ() { if ($_GET[cat_]==""){$_GET[cat_]=0;} $command = mysql_query("Select * FROM categories where parent_cat_id='$_GET[cat_]'") or die (mysql_error()); while ($data = mysql_fetch_array($command)) { $tablo[]=$data; } if ($_GET[cat_]=="0" or $_GET[cat_]==""){$numcols=4;}else{$numcols=2;} $data = range(1,count($tablo)); $numrows = ceil (count($data)/$numcols); echo '<table width="100%">'; for ($r=0; $r<$numrows; $r++) { echo '<tr>'; for ($c=0; $c<$numcols; $c++) { $cell = isset($data[$r + $c*$numrows]) ? $data[$r + $c*$numrows] : ' '; if ($tablo[$cell]['cat_img']!=""){ print ('<td width="20%"> <table border="0" cellpadding="3" cellspacing="3" width="100%"> <tr> <td><center><a href="index.php?mod=6&cat_='.$tablo[$cell]['cat_id'].'"><img border="0" src="admin/image/categ/thumbs/'.$tablo[$cell]['cat_img'].'"></a></center></td> </tr> <tr> <td><center><a href="index.php?mod=6&cat_='.$tablo[$cell]['cat_id'].'">'.$tablo[$cell]['cat_name'].'</a></center></td> </tr> </table> </td>'); }else{ print ('<td width="20%"><a href="index.php?mod=6&cat_='.$tablo[$cell]['cat_id'].'">'.$tablo[$cell]['cat_name'].'</a></td>'); } } echo '</tr>'; } echo '</table>'; } ?> see http://www.trans-f-air.com/EZA/index.php There should be 3 categorys ... not 2.
  7. ... the one i just gave works ... why are you looking for an other way? In your case use $parser1->set_handler("/question/chapter","xml_to_db1"); [...] and modify xml_to_db1 for your stuff
  8. thanks thats brilliant!
  9. Download this class and use it like this <?php include_once("class_path_parser.php"); include ("include/xml-fonc.php"); $parser1->set_handler("/STHS-Coaches/Coach/Name","xml_to_db1"); $parser1->set_handler("/STHS-Coaches/Coach/Team","xml_to_db1"); $parser1->set_handler("/STHS-Coaches/Coach/Country","xml_to_db1"); $parser1->set_handler("/STHS-Coaches/Coach/Age","xml_to_db1"); $parser1->set_handler("/STHS-Coaches/Coach/PH","xml_to_db1"); $parser1->set_handler("/STHS-Coaches/Coach/DF","xml_to_db1"); $parser1->set_handler("/STHS-Coaches/Coach/OF","xml_to_db1"); $parser1->set_handler("/STHS-Coaches/Coach/PD","xml_to_db1"); $parser1->set_handler("/STHS-Coaches/Coach/EX","xml_to_db1"); $parser1->set_handler("/STHS-Coaches/Coach/LD","xml_to_db1"); $parser1->set_handler("/STHS-Coaches/Coach/PO","xml_to_db1"); $parser1->set_handler("/STHS-Coaches/Coach/Contrac","xml_to_db1"); $parser1->set_handler("/STHS-Coaches/Coach/Salary","xml_to_db1"); if(!$parser1->parse_file("include/xml/LNHSP3-Coaches.xml")) { print("Error:".$parser1->get_error()."<br/>\n"); }else{ echo "LNHSP3-Coaches.xml parsed!<br>"; } $parser2 = new Path_parser(); $parser2->set_handler("/STHS-FarmTeam/Team/Name","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/Abbre","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/Morale","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/Point","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/GP","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/W","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/L","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/T","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/OTW","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/OTL","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/SOW","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/SOL","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/GF","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/GA","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/HomeGP","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/HomeW","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/HomeL","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/HomeT","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/HomeOTW","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/HomeOTL","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/HomeSOW","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/HomeSOL","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/HomeGF","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/HomeGA","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/PPAttemp","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/PPGoal","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/PKAttemp","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/PKGoalGA","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/PKGoalGF","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/ShotsFor","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/ShotsAga","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/ShotsBlock","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/ShotsPerPeriod1","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/ShotsPerPeriod2","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/ShotsPerPeriod3","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/ShotsPerPeriod4","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/GoalsPerPeriod1","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/GoalsPerPeriod2","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/GoalsPerPeriod3","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/GoalsPerPeriod4","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/Shutouts","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/Goals","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/Assists","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/Points","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/Pim","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/Hits","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/FaceOffWonOF","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/FaceOffWonDF","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/FaceOffWonNT","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/FaceOffTotalOF","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/FaceOffTotalDF","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/FaceOffTotalNT","xml_to_db2"); $parser2->set_handler("/STHS-FarmTeam/Team/EmptyNetGoal","xml_to_db2"); if(!$parser2->parse_file("include/xml/LNHSP3-FarmTeam.xml")) { print("Error:".$parser2->get_error()."<br/>\n"); } echo "LNHSP3-FarmTeam.xml parsed!<br>"; ?> I included in attachement the 2 XML files i used in this exemple, the class and function page I hope thats gona help. http://versatilebb.com/XML_to_DB.rar I am gona delete it when you confirme you dowloaded it
  10. i know the HTML would look something like this <table border="0" cellpadding="3" cellspacing="3" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td width="25%">1</td> <td width="25%">4</td> <td width="25%">7</td> <td width="25%">10</td> </tr> <tr> <td width="25%">2</td> <td width="25%">5</td> <td width="25%">8</td> <td width="25%">11</td> </tr> <tr> <td width="25%">3</td> <td width="25%">6</td> <td width="25%">9</td> <td width="25%">12</td> </tr> </table> But i dont see how to loop it ...
  11. No because the number of columns can change from the admin panel and the number of rows depens on the number of category to dispaly
  12. Hey guys i got a loop working like this 1 2 3 4 5 6 7 8 But i need him to work like this 1 3 5 7 2 4 6 8 How can i turn my function to do it? <?php function list_categ() { if ($_GET[cat_]==""){$_GET[cat_]=0;} $command = mysql_query("Select * FROM categories where parent_cat_id='$_GET[cat_]'") or die (mysql_error()); while ($data = mysql_fetch_array($command)) { $tablo[]=$data; } $nb=count($tablo); if ($nb!="0"){ for($i=0;$i<$nb;$i++){ if ($tablo[$i]['parent_cat_id']=="0"){$nbcol=4;}else{$nbcol=2;} if($i%$nbcol==0) print ('<table border="0" cellpadding="3" cellspacing="3" width="100%"><tr>'); $nombre = $nbthiscat; if ($tablo[$i]['cat_img']!=""){ print ('<td width="20%"> <table border="0" cellpadding="3" cellspacing="3" width="100%"> <tr> <td><center><a href="index.php?mod=6&cat_='.$tablo[$i]['cat_id'].'"><img border="0" src="admin/image/categ/thumbs/'.$tablo[$i]['cat_img'].'"></a></center></td> </tr> <tr> <td><center><a href="index.php?mod=6&cat_='.$tablo[$i]['cat_id'].'">'.$tablo[$i]['cat_name'].'</a></center></td> </tr> </table> </td>'); }else{ print ('<td width="20%"><a href="index.php?mod=6&cat_='.$tablo[$i]['cat_id'].'">'.$tablo[$i]['cat_name'].'</a></td>'); } if($i%$nbcol==($nbcol-1)) print ('</tr>'); } print ('</table>'); } } ?>
  13. in this case lang_studied[] is an array so to send it use foreach ($_POST['lang_studied'] as $value) ... ...
  14. For a one dimensional array, use the implode() function: $array = array('lastname', 'email', 'phone'); $comma_separated = implode(",", $array); echo $comma_separated; // lastname,email,phone
  15. you can add $date=date("m-d-Y"); or you can use the build in MySQL date
  16. I know this is a long shot but did you enter you connection info in mysql_connect("localhost","","");
  17. can you n least post your code so we can compare
  18. I just really don't get why you use 3 times the same db ... That would be a good enoug reason for me to neveruse your cms ...imagine ... 3 times the same stuff for 65 000 members for an avrage website after 6 month thats crazy. Explain me better why you do that, maby we can figure a better way lol
  19. he also said "Probably made with their own custom made CMS. " And thats what i belave as well. They made it ...
  20. So when is the left corner logo gona be repaired?
  21. Please note that addslashes is not the correct function to protect you from SQL injections. For example, the following line: $short_desc = addslashes($_POST['short_desc']); Should look like this: $short_desc = mysql_real_escape_string($_POST['short_desc']); addslashes() should be deprecated - it does not protect against SQL injections
  22. You should make a google search on "xss" or also called "cross site scrypting"
  23. You could handle your errors so you know why it's not uploading <?php if(!empty($_FILES['images']'name'][0])) { while(list($key,$value) = each($_FILES['images']['name'])) { if(!empty($value)) { list($fname,$ext) = split("\.", $value); if ($ext == "jpg" || $ext == "gif" || $ext == "png") { $NewImageName = $t."_offer_".$value; copy($_FILES['images']['tmp_name'][$key], "re_images/".$NewImageName); $MyImages[] = $NewImageName; }else{ echo "Only jpg, gif and png"; } }else{ echo "Value is empty"; } } if(!empty($MyImages)) { $ImageStr = implode("|", $MyImages); } }else{ echo "File not posted"; }?> Of course if your img has 11 mega px it's not gona upload lol
  24. Yeah pocobueno1388's version will be executed faster then my super lazy querry lol
  25. <?php echo "We have "; echo @current(@mysql_fetch_assoc(@mysql_query("SELECT count(id) FROM accounts "))); echo " regestred members!"; ?>
×
×
  • 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.