Jump to content

ayaya

Members
  • Posts

    16
  • Joined

  • Last visited

ayaya's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello all, I start learning php for several weeks. I got to know Smarty recently. It looks very complicated. Do you think it's necessary to learn it?
  2. come to update... for the above code, my url is: http://localhost/bbs2/list.php if i add ?page=2 behind the url, that means: http://localhost/bbs2/list.php?page=2 it works, it can show the next 5 rows of data. but only if i click the Next page on the page list.php, it doesn't work, it shows an alert page "This program cannot display the webpage.. " and if my mouse just rolls over on the text Next page, it can shows the right url on the bottom of firefox. so why it doesn't work when I click? I was stuck on this problem since two days, can anyone help me? thanks a lot!
  3. I have 10 rows of data in mysql, i want to display 5 rows of data per page in PHP. I can display 5 rows in page 1, but the page 0 (precedent page), and next page (page 2), don't work. Can anyone help me? This is my code: <?php include ("conn.php"); $pagesize=5; $url=$_SERVER["REQUEST_URI"]; $url=parse_url($url); $url=$url['path']; $numq=mysql_query("select * from `test`"); $num=mysql_num_rows($numq); $page=''; $pageval=0; if(isset($_GET['page'])){ $pageval=$_GET['page']; $page=($pageval-1)*$pagesize; $page.=','; } if($num > $pagesize){ if($pageval<=1)$pageval=1; echo "$num in total". " <a href=$url?page=".($pageval-1).">Page precedent</a> <a href=$url?page=".($pageval+1).">Next page</a>"; } $sql="select * from `test` limit $page $pagesize"; $query=mysql_query($sql); while($row=mysql_fetch_array($query)){ echo "<hr><b>".$row['name']." | ".$row['sex']; } ?>
  4. can anyone tell me what's wrong with this code? if (isset($_POST['id']=='admin')) {... } why it displays "syntax error, expecting ',' or')' ? if i want to know if the id=admin, how should I do?
  5. Thank you dear jazzman1! it works! thank you very very much! I like you so much! i'm very happy...
  6. is this one you need? config.inc.php And this problem is only with firefox. I tried in IE, no error, just enter my pwd then "go" it works for every time. But why in Firefox, there's an error 1405 for the first time, and then i click the second time "go", it works... <?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * phpMyAdmin sample configuration, you can use it as base for * manual configuration. For easier setup you can use setup/ * * All directives are explained in Documentation.html and on phpMyAdmin * wiki <http://wiki.phpmyadmin.net>. * * @package PhpMyAdmin */ /* * This is needed for cookie based authentication to encrypt password in * cookie */ $cfg['blowfish_secret'] = 'a8b7c6d'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ /* * Servers configuration */ $i = 0; /* * First server */ $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; /* Select mysql if your server does not have mysqli */ $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = true; /* * phpMyAdmin configuration storage settings. */ /* User used to manipulate with storage */ // $cfg['Servers'][$i]['controlhost'] = ''; // $cfg['Servers'][$i]['controluser'] = 'pma'; // $cfg['Servers'][$i]['controlpass'] = 'pmapass'; $cfg['Servers'][$i]['user'] = 'root'; //mysql username here $cfg['Servers'][$i]['password'] = 'lxngii'; //mysql password here /* Storage database and tables */ // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; // $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; // $cfg['Servers'][$i]['relation'] = 'pma_relation'; // $cfg['Servers'][$i]['table_info'] = 'pma_table_info'; // $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords'; // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; // $cfg['Servers'][$i]['column_info'] = 'pma_column_info'; // $cfg['Servers'][$i]['history'] = 'pma_history'; // $cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs'; // $cfg['Servers'][$i]['tracking'] = 'pma_tracking'; // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords'; // $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig'; // $cfg['Servers'][$i]['recent'] = 'pma_recent'; /* Contrib / Swekey authentication */ // $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf'; /* * End of servers configuration */ /* * Directories for saving/loading files from server */ $cfg['UploadDir'] = ''; $cfg['SaveDir'] = ''; /** * Defines whether a user should be displayed a "show all (records)" * button in browse mode or not. * default = false */ //$cfg['ShowAll'] = true; /** * Number of rows displayed when browsing a result set. If the result * set contains more rows, "Previous" and "Next". * default = 30 */ //$cfg['MaxRows'] = 50; /** * Use graphically less intense menu tabs * default = false */ //$cfg['LightTabs'] = true; /** * disallow editing of binary fields * valid values are: * false allow editing * 'blob' allow editing except for BLOB fields * 'all' disallow editing * default = blob */ //$cfg['ProtectBinary'] = 'false'; /** * Default language to use, if not browser-defined or user-defined * (you find all languages in the locale folder) * uncomment the desired line: * default = 'en' */ //$cfg['DefaultLang'] = 'en'; //$cfg['DefaultLang'] = 'de'; /** * default display direction (horizontal|vertical|horizontalflipped) */ //$cfg['DefaultDisplay'] = 'vertical'; /** * How many columns should be used for table display of a database? * (a value larger than 1 results in some information being hidden) * default = 1 */ //$cfg['PropertiesNumColumns'] = 2; /** * Set to true if you want DB-based query history.If false, this utilizes * JS-routines to display query history (lost by window close) * * This requires configuration storage enabled, see above. * default = false */ //$cfg['QueryHistoryDB'] = true; /** * When using DB-based query history, how many entries should be kept? * * default = 25 */ //$cfg['QueryHistoryMax'] = 100; /* * You can find more configuration options in Documentation.html * or here: http://wiki.phpmyadmin.net/pma/Config */ ?>
  7. thanks but it still doesn't work :'( . it's still like before, I must click the "GO" second time. for the first time, there's still the error #1045
  8. I got the message "#1045 Cannot log in to the MySQL server" on the phpMyAdmin Log in page. It's different from others. I tried all other solutions I found on the internet. But no one works. My problem is: if i enter my username and password for the first time, i click "go", it doesn't work, the message "#1045 Cannot log in to the MySQL server" appear on the top. But when i reclick "Go" for the second time, it works! It happens each time like this when I log in. That means I must log in two times every time. Can anyone help me? My config.inc.php is like this: <?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * phpMyAdmin sample configuration, you can use it as base for * manual configuration. For easier setup you can use setup/ * * All directives are explained in Documentation.html and on phpMyAdmin * wiki <http://wiki.phpmyadmin.net>. * * @package PhpMyAdmin */ /* * This is needed for cookie based authentication to encrypt password in * cookie */ $cfg['blowfish_secret'] = 'a8b7c6d'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ /* * Servers configuration */ $i = 0; /* * First server */ $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; /* Select mysql if your server does not have mysqli */ $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = false; /* * phpMyAdmin configuration storage settings. */ /* User used to manipulate with storage */ // $cfg['Servers'][$i]['controlhost'] = ''; // $cfg['Servers'][$i]['controluser'] = 'pma'; // $cfg['Servers'][$i]['controlpass'] = 'pmapass'; $cfg['Servers'][$i]['user'] = 'root'; //mysql username here $cfg['Servers'][$i]['password'] = 'MYPASSWORD'; //mysql password here /* Storage database and tables */ // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; // $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; // $cfg['Servers'][$i]['relation'] = 'pma_relation'; // $cfg['Servers'][$i]['table_info'] = 'pma_table_info'; // $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords'; // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; // $cfg['Servers'][$i]['column_info'] = 'pma_column_info'; // $cfg['Servers'][$i]['history'] = 'pma_history'; // $cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs'; // $cfg['Servers'][$i]['tracking'] = 'pma_tracking'; // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords'; // $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig'; // $cfg['Servers'][$i]['recent'] = 'pma_recent'; /* Contrib / Swekey authentication */ // $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf'; /* * End of servers configuration */ /* * Directories for saving/loading files from server */ $cfg['UploadDir'] = ''; $cfg['SaveDir'] = ''; /** * Defines whether a user should be displayed a "show all (records)" * button in browse mode or not. * default = false */ //$cfg['ShowAll'] = true; /** * Number of rows displayed when browsing a result set. If the result * set contains more rows, "Previous" and "Next". * default = 30 */ //$cfg['MaxRows'] = 50; /** * Use graphically less intense menu tabs * default = false */ //$cfg['LightTabs'] = true; /** * disallow editing of binary fields * valid values are: * false allow editing * 'blob' allow editing except for BLOB fields * 'all' disallow editing * default = blob */ //$cfg['ProtectBinary'] = 'false'; /** * Default language to use, if not browser-defined or user-defined * (you find all languages in the locale folder) * uncomment the desired line: * default = 'en' */ //$cfg['DefaultLang'] = 'en'; //$cfg['DefaultLang'] = 'de'; /** * default display direction (horizontal|vertical|horizontalflipped) */ //$cfg['DefaultDisplay'] = 'vertical'; /** * How many columns should be used for table display of a database? * (a value larger than 1 results in some information being hidden) * default = 1 */ //$cfg['PropertiesNumColumns'] = 2; /** * Set to true if you want DB-based query history.If false, this utilizes * JS-routines to display query history (lost by window close) * * This requires configuration storage enabled, see above. * default = false */ //$cfg['QueryHistoryDB'] = true; /** * When using DB-based query history, how many entries should be kept? * * default = 25 */ //$cfg['QueryHistoryMax'] = 100; /* * You can find more configuration options in Documentation.html * or here: http://wiki.phpmyadmin.net/pma/Config */ ?>
  9. exit f(2) echo after: 1; exit f(1); echo after: 0; Thank you for your help. But if exit f(2) and f(1), How comes the result after "afer"? I still don't understand it. Sorry I'm very stupid...
  10. <? function f($a) { if($a<2) { echo "before:".$a."</br>"; f($a+1); echo "after:".$a."</br>"; } } f(0); ?> Why the result is: before:0 before:1 after:1 after:0 Can anyone help?
  11. hehe, finally i did it myself! i'm very happy else if($order=="resort"){ //multiplication table in descendant order for($j=$endNum;$j>=$startNum;$j--){ for($l=$startNum;$l<=$j;$l++){ print "$l*$j=".$j*$l." "; } echo "<br />"; } } else { //multiplication table in ascendant order for($j=$startNum;$j<=$endNum;$j++){ for($l=$startNum;$l<=$j;$l++){ print "$l*$j=".$j*$l." "; } echo "<br />"; } }
  12. Hello, I want to have a multiplication table only from 3 to 7. Please see my code, first: <?php function fun($startNum,$endNum=9,$order){ if($startNum == ""){ echo "fun () // repeat an alert six times: <br>"; for($j=1;$j<=6;$j++){ echo "please enter at least one number!"."<br>"; } } else if($order=="resort"){ //multiplication table in descendant order for($j=$endNum;$j>=$startNum;$j--){ for($l=1;$l<=$j;$l++){ print "$l*$j=".$j*$l." "; } echo "<br />"; } } else { //multiplication table in ascendant order for($j=$startNum;$j<=$endNum;$j++){ for($l=1;$l<=$j;$l++){ print "$l*$j=".$j*$l." "; } echo "<br />"; } } } echo "multiplication table: <br>"; fun(1); echo "<br />"; echo "ascendant from 3 to 7: <br>"; fun(3,7); echo "<br />"; echo "descendant from 7 to 3: <br>"; fun(3,7,"resort"); echo "<br />"; fun(); ?> The result of this code is: But I want to have this: So I change my code to this: else if($order=="resort"){ //multiplication table in descendant order $l=$startNum; for($j=$endNum;$j>=$startNum;$j--){ for($l=$j;$l<=$j;$l--){ print "$l*$j=".$j*$l." "; } echo "<br />"; } } But it doesnt work! it's a dead loop... why? Can anyone help me? Thanks in advance
  13. Thank you very much! It works! Here is really a good place! thanks thanks a lot... Sorry, this is my first post, next time I'll know how to post code
×
×
  • 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.