Jump to content

canabatz

Members
  • Posts

    116
  • Joined

  • Last visited

Everything posted by canabatz

  1. i dont see any thing wrong , jus a missing */ in your code. try this one again: <?php /* Get the letter user clicked on and assign it a variable called $sort */ $sort = $_REQUEST['letter']; /* Let's check if variable $sort is empty. If it is we will create a query to display all customers alphabetically ordered by last name. */ if($sort == ""){ $qry= "SELECT * FROM myDatabase.t_clientes ORDER BY company_name ASC " ; }else{ /* if varible $sort is not empty we will create a query that sorts out the customers by their last name, and order the selected records ascendingly. */ $qry = "SELECT * FROM myDatabase.t_clientes WHERE company_name LIKE '$sort%' ORDER BY company_name ASC" ; } /* Notice the use of '%' wilde card in the above query "LIKE '$sort%'". */ //next step is to execute the query. $execute = mysql_query($qry) or die(mysql_error()); /* Before we display results let's create our alphabetical navigation. for ($i = 65; $i < 91; $i++) { printf('<a href="%s?letter=%s">%s</a> | ', $PHP_SELF, chr($i), chr($i)); } echo " " ; /* now we are ready to display the results. */ ?> <table width="400" border="1"> <tr> <td>client</td> <td>company name</td> <td>Phone</td> </tr> <?php if(mysql_num_rows($execute)>0){ while($result = mysql_fetch_assoc($execute)); { ?> <tr> <td><?php echo $result['id_cliente']; ?></td> <td><?php echo $result['company_name']; ?></td> <td><?php echo $result['cliente_tel'];?></td> </tr> <? } }else{ echo " No customer found. " ; } ?> </table>
  2. please show the all code to see where the problem is.
  3. try this: <table width="400" border="1"> <tr> <td>client</td> <td>company name</td> <td>Phone</td> </tr> <?php if(mysql_num_rows($execute)>0){ while($result = mysql_fetch_assoc($execute)); { ?> <tr> <td><?php echo $result['id_cliente']; ?></td> <td><?php echo $result['company_name']; ?></td> <td><?php echo $result['cliente_tel'];?></td> </tr> <? } }else{ echo " No customer found. " ; } ?> </table>
  4. try that: <table width="400" border="1"> <tr> <td>client</td> <td>company name</td> <td>Phone</td> </tr> <?php if(mysql_num_rows($execute)>0){ while($result = mysql_fetch_assoc($execute)); { ?> <tr> <td><?=$result['id_cliente'] ?></td> <td><?=$result['company_name'] ?></td> <td><?=$result['cliente_tel']?></td> </tr> <? } }else{ echo " No customer found. " ; } ?> </table>
  5. function safe($value){ return mysql_real_escape_string($value); } if($_POST['submit']) { $username1=safe($_POST['username']); $password=safe($_POST['password']); .......more code here
  6. <table width="400" border="1"> <tr> <td>client</td> <td>company name</td> <td>Phone</td> </tr> <?php if(mysql_num_rows($execute)>0){ do{ }while($result = mysql_fetch_assoc($execute)); ?> <tr> <td><?=$result['id_cliente'] ?></td> <td><?=$result['company_name'] ?></td> <td><?=$result['cliente_tel']?></td> </tr> <? }else{ echo " No customer found. " ; } ?> </table> try that , i hope this is what you want
  7. when im using coupons in my system i generate them my self , if i give a costumer a coupon and he will use it will update the coupon in the data base this coupon allready been used. i think it the easy way of using coupons.
  8. <?php if(mysql_num_rows($execute)>0){ do{ echo " " .$result['id_cliente']. " " .$result['company_name']. " " .$result['cliente_tel']. " "."<br>" ; }while($result = mysql_fetch_assoc($execute)); }else{ echo " No customer found. " ; } ?>
  9. Thanks all for the help. i did it by my self and im happy. maybe it's not the best way but i did some good combinations. $sqlSURVEY_AnsSUid=mysql_query("SELECT * FROM `xp_survey_answer` ")or die(mysql_error()); while ($rowSURVEY_Ans=mysql_fetch_array($sqlSURVEY_AnsSUid)) { $ans_su_id[]=$rowSURVEY_Ans['ans_su_id']; } $str2 = implode(',',array_unique($ans_su_id)); $zz4= count(explode(",",$str2)); echo $zz4."<br>"; $sqlSURVEY_Amax=mysql_query("SELECT max(ans_q_id) as maxq FROM `xp_survey_answer` ")or die(mysql_error()); $rooo=mysql_fetch_assoc($sqlSURVEY_Amax); $maxq=$rooo['maxq']; $sqlSURVEY_Ac=mysql_query("SELECT * FROM `xp_survey_answer` where ans_su_id='".$_GET['SUR_ID']."'")or die(mysql_error()); $a=0; while ($rowSURVEY_Ac=mysql_fetch_array($sqlSURVEY_Ac)) { $ans_q_id[]=$rowSURVEY_Ac['ans_q_id']; echo $ans_q_id[$a]."<br>"; $a++; } $str1 = implode(',',array_unique($ans_q_id)); // add quote to seprate number of strings echo "<br>".$str1; // 33,34 $zz= count(explode(",",$str1)); // count the number to add plus echo "<br>".$zz; // 2 $zz1=explode(",",$str1); $sqlSURVEY_A=mysql_query("SELECT * FROM `xp_survey_answer` where ans_su_id='".$_GET['SUR_ID']."'")or die(mysql_error()); while ($rowSURVEY_A=mysql_fetch_assoc($sqlSURVEY_A)) { $ans_caption= $rowSURVEY_A['ans_caption']; $ans_position= $rowSURVEY_A['ans_position']; $ans_su_id= $rowSURVEY_A['ans_su_id']; $ans_q_id=$rowSURVEY_A['ans_q_id']; for ($i=0; $i<=$zz; $i++) { if ($ans_q_id==$zz1[$i]){$ans_q_id=($ans_q_id+($maxq / $zz) )+ $zz4;} } $copy_AM=mysql_query("INSERT INTO `xp_survey_answer` (`admin_id`, `ans_id`, `ans_caption`, `ans_position`, `ans_su_id`, `ans_q_id`) VALUES ('$adminid','','$ans_caption','$ans_position','$suid','$ans_q_id')")or die(mysql_error()); }
  10. here is the code im using right now to just copy from other survey, only the answer option. $sqlSURVEY_A=mysql_query("SELECT `admin_id`, `ans_id`, `ans_caption`, `ans_position`, `ans_su_id` FROM `xp_survey_answer` where ans_su_id='".$_GET['SUR_ID']."'")or die(mysql_error()); while ($rowSURVEY_A=mysql_fetch_assoc($sqlSURVEY_A)) { $ans_caption= $rowSURVEY_A['ans_caption']; $ans_position= $rowSURVEY_A['ans_position']; $ans_su_id= $rowSURVEY_A['ans_su_id']; $ans_q_id= $rowSURVEY_A['ans_q_id']; // the one i need to get the MAX() and add +1 , if you got 3 answers then it's the same id $copy_AM=mysql_query("INSERT INTO `xp_survey_answer` (`admin_id`, `ans_id`, `ans_caption`, `ans_position`, `ans_su_id`, `ans_q_id`) VALUES ('$adminid','','$ans_caption','$ans_position','$suid','$ans_q_id')")or die(mysql_error()); }
  11. i told you. im building a survey site. users can build surveys and send them to who they want. the client who i made this site for him ,he want to build Template survey's so the users can copy them to they account and modify them for what they need. what i did was to create one account and build few templates and add a link to see surveys example . on every example survey i will add a copy button so register users can copy the survey to they account. each survey are using 3 different tables. 1 survey 2 survey question 3 survey answer im stuck with the survey question. normaly when you add new question it gives it a question ID. in my example ,a question have 3 answer options. so you have question position for the 3 answer ,and question id is the same. what i need is to duplicate survey with more questions . so if A_Q_ID have 1 1 1 2 2 2 the copy i need is 3 3 3 4 4 4. thats it ,sorry for my bad explanation and my bad English thanks
  12. im stuck here: i got this for example , this i s not the real table, the real table is very complicated. i can copy the all table and it's fine, but the A_Q_ID is my problem. what i try'd was to get the MAX(A_Q_ID) to add +1 to the duplicated data. but there is 3 in this example with same id. id----------position-------------A_Q_ID 1---------------1--------------------5----- 2---------------2--------------------5----- 3---------------3--------------------5----- 4---------------1--------------------6----- 5---------------2--------------------6----- 6---------------3--------------------6----- what i need to have after the copy is like that: result example: id------------position-------------A_Q_ID 7-----------------1--------------------7----- 8-----------------2--------------------7----- 9-----------------3--------------------7----- 10---------------1--------------------8----- 11---------------2--------------------8----- 12---------------3--------------------8----- how can i add +1 to the duplicated A_Q_ID for the result table in my example? thanks
  13. Now you speaking nice, thanks. what i need is a simple way to do it. there is 4 tables im copying data from . 3 tables are ok . 1 table making me problem. thanks
  14. Rudeness? it's you! i was asking a simple question to problem im trying to fix. you said that it is poor desing!! not me. dont judge people with what you know! probably you don't know everything. and please , if you want to help do that.
  15. im building a survey website ,and i want to build a ready made survey so people can duplicate ready made survey to there account. that's not explaining what i need? you dont need to help if you dont know how to do it. people asking question when they need help. if you see some websites i develop then you wont say poor design , you dont know who you talking to!! thanks any way for your "help"
  16. thats a funny answer i felt bored so i ask this question i need it my friedn , im duplicating few tables and this one is my problem. im building a survey website ,and i want to build a ready made survey so people can duplicate ready made survey to there account. everything is working fine , only this table is hard... thanks
  17. Hi ,im face little problem in duplicating rows. it's not easy task wht i need: i got this rows right now id----------position-------------A_Q_ID 1---------------1--------------------5----- 2---------------2--------------------5----- 3---------------3--------------------5----- 4---------------1--------------------6----- 5---------------2--------------------6----- 6---------------3--------------------6----- what i need is to duplicat all the rows and have them inserted after the rows i allready have like that: id------------position-------------A_Q_ID 7-----------------1--------------------7----- 8-----------------2--------------------7----- 9-----------------3--------------------7----- 10---------------1--------------------8----- 11---------------2--------------------8----- 12---------------3--------------------8----- i tryed few ways without success . any idea how to do that please? i cannot get the logic on doing it thanks
  18. Hi i got a search form and when im searhing for result i get nothing. i got 5 search fields : 1. Erea 2. category 3. subcategory 4. from price 5. to price if im not specifieing from price and to price i get blank result ,if i do specify the from price to price ,then i get the results. this is the code im using to get the results. $sql=mysql_query("select * from posts where erea = '$erea' and category = '$category' and sub_category = '$subcategory' and price >= '$fromprice' and price <= '$toprice'"); what i want is to get the result even if i didnt specify the price from, to . thanx
  19. It is working great!! im trying for two days now to solve it by myself!! i came here after i get too tired ) thanx allot man!!
  20. Hi guys! i got this code: <? $x = "abcde"; str_split($x); for ($k=0; $k<=119; $k++){ $ax = array($x[0],$x[1],$x[2],$x[3],$x[4]); shuffle($ax); $text = implode("", $ax) . ""; echo $text; echo "<br />"; } ?> if you test it you see that it is working but giving me allot of duplicates results! there is a way to ignore duplicaes while it is runing? thanx.
  21. sorry , i want to find the value of input form after submit! value="?" how to find the ? thanx
  22. Hi , im trying to read a source code of a page and i want to know what is between name="?" ,i want to find the ? name="how to read this?" how to do that? thabx
  23. i just want to auto fill the forms, what is the problem? i just want to know if it is possible in any way? thanx
  24. im trying to build a script that will auto fill the form on Facebook.com i want to auto fill the email and password! is it possible? if yes ,what is the way doing it? i tryd some posting and the fields are staying empty!! thanx
×
×
  • 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.