PHP - Need Help Asap On Php Mysql Problem
well i am having a new problem i didnt relize this till now and my website has gone live and i need a fix asap before my user's leave and never return ='(
well when i set up a auction there is a image upload where you can upload your image... when trying to upload the image it change page and gave me this error Code: [Select] A Mysql error has occurred while running the script: The query you are trying to run is invalid Mysql Error Output: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND page_handle='auction'' at line 2 SQL Query: SELECT box_id, box_value FROM custom_fields_data WHERE owner_id= AND page_handle='auction' it was working before then i change some things around and dont remember what i change and found that this came up when setting up the image.... please help really need the help asap. i dont know what to do =( Similar TutorialsHi Guys, I've managed to code what i need it do to but i have an issue, below is my code: Code: [Select] $postcode=$_GET['postcode']; function countchar ($string) { $resultpostcode = strlen ($string) - substr_count($string, ' '); echo $resultpostcode; } countchar ($postcode); if ( $resultpostcode == 6 ) { echo "Postcode1 "; echo substr($postcode, 0, 3); echo "<br>"; echo "Postcode2 "; echo substr($postcode, 3); } elseif( $resultpostcode == 7 ){ echo "Postcode1 "; echo substr($postcode, 0, 4); echo "<br>"; echo "Postcode2 "; echo substr($postcode, 4); }else { echo "error"; } If the value of postcoderesult is 6 (it even outputs 6) then it wont echo what it should be doing, the same if its 7. It just keeps echoing Error. Any help would be great please. Thank you. I trying to make it so i can in put the data from a database into a theme i got from theme forest but im having few problems. the theme and page http://warp.nazwa.pl/dc/innovation/portfolio.html The NEXT button on the portfolio see how it slides across and works nicely here but on my page http://www.jigsawsoulmedia.com/root/Files/jigsawsoulmedia.com/_public/template.php its stopped working since I've place my php code in there and i can't see why not, everything look right to be from the html and php. Could one you lovely people see what you can spot wrong. page code with php below <!-- PAGE CONTENT HERE, PORTFOLIO LIST AND RIGHT SIDE BAR --> <div id="portoflioHeaderContainer"> <!-- PAGE TITLE AND NAVIGATION TREE --> <h1 class="commonPageTitle">Portfolio</h1> <div id="navigationTreeContainer"> <a href="index.html" class="prev">Home</a> \ <a class="current">Portfolio</a> </div> <!-- navigationTreeContainer --> <!-- SHORT TEXT THAT DESCRIBE PAGE CONTENT --> <p class="commonIntroductionText"> Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae. Nemo enim ipsam voluptatem quia <span class="spanBold">voluptas sit aspernatur</span> aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet consectetur, adipisci velit. </p> <!-- PORTFOLIO STATISTICS, CURRENT/ALL PAGE AND CURRENT/ALL PROJECT NUMBER --> <div class="portfolioStatisticsContainer"> <div class="pageStatsWrapper"> <span id="pageNumber"></span><span id="pageCount"></span> </div> <div class="imageStatsWrapper"> <span id="hoveredImageIndex">Project: 1/</span><span id="numberOfImages">0</span> </div> </div> <!-- portfolioStatisticsContainer --> </div> <!-- portoflioHeaderContainer --> <div id="portfolioContainer"> <div class="portfolioPage"> <?php $result = "SELECT * FROM portfolio"; $result = mysql_query ($result) or die (mysql_error()); $i=0; while($row = mysql_fetch_assoc($result)) { if($i==2) $divclass = 'portfolioProjectWrapper borderWhite'; else $divclass = 'portfolioProjectWrapper borderGray'; echo ' <div class="'.$divclass.'"> <a href="portfolioPage.html" class="image asyncImgLoad" title="img/'.$row['image290x290'].'"></a> <p class="imageDesc">'.$row['image290x290_phot'].'</p> <h3 class="title">'.$row['title'].'</h3> <p class="subtitle">'.$row['subtitle'].'</p> <p class="desc"> '.substr($row['description'], 0, 1200).' <a href="portfolioPage.html" class="commonLink">Read more</a> </p> </div> '; if($i==2) $i=0; else $i++; } ?> </div><!-- portfolioPage --> </div> <!-- portfolioContainer --> <!-- PORTFOLIO CONTROL PANEL --> <div id="portfolioControlPanel"> <div id="portfolioPrevPageBtn">Prev page</div> <div id="portfolioNextPageBtn">Next page</div> </div> <!-- portfolioControlPanel --> <div class="clearBoth"></div> Thanks for taking a look! I Have Taken The User_name In Session and i want to Make a Table as User_name as Prefix and When The User Logs in i want to show tht Table To the User !!!! i downloaded this code for a web based project management system http://www.devshed.com/c/a/PHP/Project-Management-Overview/3/ i downloaded here im a beginner in php i need some one to run this code i cant understand whether this executes or not i have created all the datatbases required the code is correct but i cannot make it run plzz guys need help some one when i login error comes in login page Deprecated: Function eregi() is deprecated in C:\wamp\www\Project_Management\functions.php on line 3 Warning: mysql_query() [function.mysql-query]: Access denied for user 'SYSTEM'@'localhost' (using password: NO) in C:\wamp\www\Project_Management\login.php on line 33 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\Project_Management\login.php on line 33 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\Project_Management\login.php on line 34 Wordpress gave me the following error when uploading the this themeforest theme. failed opening '/srv/htdocs/wp-content/themes/QuickFixWebiste(Wordpress)/../../../wp-admin/includes/class-walker-nav-menu-edit.php' for inclusion (include_path='.:/usr/local/php7.2/lib/php') in /srv/htdocs/wp-content/themes/QuickFixWebiste(Wordpress)/library/core/admin/edit-menu-walker.php Can anyone tell me how to resolve this? The source code in the edit-menu-walker.php on lines 1-4 is: <?php if (!class_exists('Walker_Nav_Menu_Edit')){ include_once(get_template_directory() . '/../../../wp-admin/includes/class-walker-nav-menu-edit.php'); }
Hello, I'm working on this PHP website of my college. Where in after sending the order to the vendor an e-mail is sent to the person who ordered and the head of that department notifying them about the details of order along with that now I need to send a tracking number of every order in that e-mail which gets automatically incremented in subsequent orders. So please let me know how should I approach or do this. Thank you. Hi all. I'm not sure if this post belongs here or in the MySQL forum because I'm not entirely sure where the problem is. I have a script that takes data from a form and puts it into a database. There are several tables that were hand built and the script works fine with those. There are several tables that were converted from M$ Access to MySQL and the script does not work with those. All tables are InnoDB (if that matters). My inkling is that the converted tables that have weird field names, some containing "%","#", and "-" characters, are interfering with the MySQL statement to do the insert. Any thoughts on this? Would those odd characters for field names in fact affect the MySQL statement to enter data? P.S. I don't have access to the code at the moment. Can post it later unless the solution to this problem is simple (i.e. weird characters are the problem). Thanks in advance! So i started on a project and not within long, i hit a wicked wall. The upper part works fine, i get the correct $pilotcorpid, however it doesnt seem to query the 2nd time, it just uses the variable from the first time. I have the information in the database, i just need to pick em out right. Code: [Select] <?php include 'config.php'; //database config include 'opendb.php'; //connect database $search = @$_GET['q'] ; //getting a name from a form $result = mysql_query("SELECT * FROM kb3_pilots WHERE plt_name='$search'")or die(mysql_error()); //here i choose to check in the kb3_pilots table, the plt_name column for the name written in the form earlier. $pilotcorpid=mysql_result($result,"plt_crp_id"); //since i found the guy in the query, i need info from that column, the plt_crp_id. $resultcorp = mysql_query("SELECT * FROM kb3_corps WHERE crp_id='$pilotcorpid'")or die(mysql_error()); //now we query the kb3_corps table to check if the corp exists. $pilotcorpname=mysql_result($resultcorp,"crp_name"); //Because it did, i will now pull out the name echo "TEST: Pilot Id: $pilotcorpid and corp name: $pilotcorpname"; include 'closedb.php'; ?> If somebody also have a big php/mysql ebook which explains commands great, that would be awesome. Best regards, Mumlebumle HI - I am dynamically populating a drop down form list from the table 'hotels', and the 'est_town' column. It is supposed to only list each town once, but several towns appear multiple times. Am I using the DISTINCT command correctly and if so, what can i do to stop multiple appearances of towns? Code: [Select] $query_hotels_select = "SELECT DISTINCT est_town FROM hotels ORDER BY est_town ASC"; $hotels_select = mysql_query($query_hotels_select, $contractors) or die(mysql_error()); $row_hotels_select = mysql_fetch_assoc($hotels_select); $totalRows_hotels_select = mysql_num_rows($hotels_select); FORM BIT Code: [Select] <select name="digs" id="digs"> <?php do { ?> <option value="<?php echo $row_hotels_select['est_town']?>"<?php if (!(strcmp($row_hotels_select['est_town'], $row_hotels_select['est_town']))) {echo "selected=\"selected\"";} ?>><?php echo ucwords(strtolower($row_hotels_select['est_town']))?></option> <?php } while ($row_hotels_select = mysql_fetch_assoc($hotels_select)); $rows = mysql_num_rows($hotels_select); if($rows > 0) { mysql_data_seek($hotels_select, 0); $row_hotels_select = mysql_fetch_assoc($hotels_select); } ?> </select> Hello All, I Develop a small e-shop and i am facing a problem with invoice number I attach to an order the invoice number after client has successfully paid the order through Paypal, so i use the function below to retrieve the next inv num function GET_NEXT_INV_NUM() { $query= "SELECT MAX(inv_num) AS max_inv_num FROM orders"; $rs_query = mysql_query($query, $db) or die(mysql_error()); $row_query = mysql_fetch_assoc($rs_ws_mod_tvg_program_rec); $Next_inv_num = $row_query['max_inv_num']+1; return $Next_inv_num; } all looked to work fine but one day i realised that i have some invoice numbers that are missing, because in some cases instead of next inv to increase by one, is increased by two for example: INV NUMBERS: ============ 101 102 103 --->PROBLEM HERE (MISSING 104) 105 106 107 108 109 110 --->PROBLEM HERE (MISSING 111) 112 113 114 115 116 ... I check all of my code 3-4 times and all looks ok Can anyone help me please??? Thanks in advance (i apologise for my english) Well im using paypal IPN im trying to get it to update something out of my database. Heres the code I think this is all you need Quote <?php include('config.php') ?> <?php function updatePayments($data){ global $link; if(is_array($data)){ $sql = mysql_query("INSERT INTO `serverb` WHERE name = 'Official' (gold) VALUES ('yes')"); } } ?> How do i get it to work? I creating a members only web for my wife's 45th reunion. Everything went great untill I tackled something I never did before. PHP! From the home page I'm having the user enter a username and password. I created the db using phpmyadmin and populated the table with two users. I checked the include and it is attempting to open the db and proper table. however, the php loginck.php, goes to the programed error message. Can I get a little assistance, it would be greatly appreciated. The form calls loginck,pfp and it gets there OK. <div class="art-blockcontent"> <div class="art-blockcontent-body"> <!-- block-content --> <div style="border: medium ridge blue;padding:15px; font-size:.8em;"> To assist in maintaining contact with our alumni, please register. <br> Already registered, sign in. <br><br> <form action="loginck.php" method="POST"> <label>Username: </label><input type="varchar" style="height: 1em;" size="15" name="passWord" required> <br> <label>Password: </label><input type="password" style="height: 1em;" size="15" name="passWord" required> <br><br> <center><input type="submit" value="Sign In"> <input type="reset" value="Clear"></center> </form> <br><br> <a href="register.html">Register</a> <br> <hr> <br> This site best viewed using Google Chrome, FireFox, or Opera browsers. </form> </div> <!-- /block-content --> I attached loginck.php and the inserted a called file 'z_db.php' for your review. I know if I can get this figured out I can do the others I need to do. Sorry, if ther's too many typos, I'm relegated to typing with one finger (Stroke) and in a wheel chair. This is my code it always returns null i know that there is info in the table but it never works
$sql = 'SELECT * FROM $user WHERE ticker = "$ticker"'; $resultsql = mysqli_query($conp,$sql); $row = mysqli_fetch_array($resultsql); echo $row[ticker]; var_dump($row); echo '<br>'; this is probably going to be really simple to fix but i cant figure it out :/ on one page i have a form which uses php to populate a dropdown box, now this form will allow the user to add 1 to the person which was selected in the dropdown box. The code for this looks like this.. <form action="addpoint.php" method="post"> <select> <?php $sql="SELECT id,name FROM man"; $result =mysql_query($sql); while ($data=mysql_fetch_assoc($result)){ ?> <option value ="<?php echo $data['id'] ?>" ><?php echo $data['name'] ?></option> <?php } ?> </select> <input type="submit" value="Add Point"/> </form> the php to process this form looks like this.. <?php $sql="UPDATE man SET points = (points + 1) WHERE name = ('$_POST[name]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "$_POST[name] has been added"; mysql_close($con) ?> The problem i have is that i dont think its pulling the name from the form so therefore it wont effect the database, ive tried the sql like this.. UPDATE man SET points = (points + 1) WHERE name = 'joe' and it works fine, any help would be gratefully received Owen i could connect to the database and i dod nothing but to go through privileges in phpmyadmin by selecting privileges of the data base i design and by using the icon (action) it gave me a page to edit user i selected all check boxes mentioned in the global privileges then pressed go and for resource limits i read a note that said setting these options to zero removes the limit i set then to 1 and by using the connection function i could connect to the data base Code: [Select] <?php $connectdb = mysql_connect('localhost','root','') or die("not connected"); $selectdb = mysql_select_db("koora", $connectdb); if($selectdb) { echo "ok you,re now connected to table "; }else die("couldn,t connect to the database"); when refreshing my page it showed a message that said ok you,re now connected to table but i got another problem which is by using this form <form action="admins.php" method='post'> <table align="center" valign="center"> <tr> <td> Admin,s name: </td> <td><input type="text" name="adminname" /><br /></td></tr> <td>Admin,s Password: </td> <td><input type="password" name="adminpassword" /></td></tr> <td><input type="submit" value="Add New Admin" /></td></tr> </form> </tr> </table> to enter user name and password and by using the following code to get the data to the page the form directs to $admin = $_POST['adminname']; $password = $_POST['adminpassword']; if($admin&&$password){ mysql_query("INSERT INTO 'admin'('','admin','password') VALUES('','$admin','$password');"); echo "admin was added"; }else die("not added"); every time i enter a name and password to the text box and press enter it shows the message that admin was added and by checking the table which data are entered and stored i find nothing was added and the table is empty i guess that this problem is because of something wrong with the database may be something with settings or some like that i need your help with this problem Thanks in advance Hello everyone.
I have a large table consisting of 135497 rows
I have found that by indexing the table, it will take less time in quering the results.
In some site it shows that Using "Explain" before the queries will show that how much rows it has to travel to get the desired results.
SO I have doen and it shows like below...
mysql> EXPLAIN select * FROM ip2country WHERE 3084727327 BETWEEN begin_long_ip AND end_long_ip; +----+-------------+------------+------+---------------------------------------------------------------------------------+------+---------+------+--------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+------------+------+---------------------------------------------------------------------------------+------+---------+------+--------+-------------+ | 1 | SIMPLE | ip2country | ALL | ip_adress,begin_long_ip,end_long_ip,begin_long_ip_3,count_index,begin_long_ip_2 | NULL | NULL | NULL | 135497 | Using where | +----+-------------+------------+------+---------------------------------------------------------------------------------+------+---------+------+--------+-------------+The above results shows 135497. means it has to travel all the rows to get the result. So i have done index on the column ("begin_long_ip and end_long_ip) mysql> CREATE INDEX count_index ON ip2country(begin_long_ip,end_long_ip); Query OK, 135497 rows affected, 1 warning (0.87 sec) Records: 135497 Duplicates: 0 Warnings: 1But it still shows the same result. mysql> EXPLAIN select * FROM ip2country WHERE 3084727327 BETWEEN begin_long_ip AND end_long_ip; +----+-------------+------------+------+---------------------------------------------------------------------------------+------+---------+------+--------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+------------+------+---------------------------------------------------------------------------------+------+---------+------+--------+-------------+ | 1 | SIMPLE | ip2country | ALL | ip_adress,begin_long_ip,end_long_ip,begin_long_ip_3,count_index,begin_long_ip_2 | NULL | NULL | NULL | 135497 | Using where | +----+-------------+------------+------+---------------------------------------------------------------------------------+------+---------+------+--------+-------------+Ahy help will be greatly apprecaited... I have an array of data from a mysql result. The problem I have is that I want to find out what the next row is going to be in advanced. At the moment I have Code: [Select] while($row = mysql_fetch_assoc($rs) { echo 'Order ID: ' . $row['order_id']; } This just echo's out the order_id of the current row. However I want to find out if the order_id on the next row is going to be the same or different. If it's different I will want to echo out something else. Code: [Select] while($row = mysql_fetch_assoc($rs) { echo 'Order ID: ' . $row['order_id']; //If order_id + 1 is different then echo echo 'Total: ' . $row['total'] } Does anyone know a way round this problem? Thanks Hope someone can help. i am trying to search between two date ranges but am not sure how to add it to the rest of my query. this is my original query which works fine .. it does not have the start and end date part Code: [Select] $query = "SELECT * FROM table WHERE hdt1 like '%$hdt1_search%' and hdt2 like '%$hdt2_search%' and hdt3 like '%$hdt3_search%' and dateadd like '$dateadd_search'"; this is the start date to end date search, ...it works ok when it is the only thing in the query Code: [Select] $query = "SELECT * FROM table WHERE dateadd >= '$start_date' AND dateadd <= '$end_date'"; BUT, when i try to put it all together the only two fields that get search are the start date to end date search. ... Code: [Select] $query = "SELECT * FROM table WHERE hdt1 like '%$hdt1_search%' and hdt2 like '%$hdt2_search%' and hdt3 like '%$hdt3_search%' and dateadd like '$dateadd_search' and dateadd >= '$start_date' AND dateadd <= '$end_date' "; what am i doing wrong???? I'm working on my website, and I'm having a bit of trouble in getting PHP to select the proper data. I'm trying to select usernames from my database where rank is equal to one (the highest, in my system). As such, I attempted this code; Code: [Select] // Connection info above this line... mysql_select_db("users"); $query = mysql_query ("SELECT displayname FROM login WHERE rank = 1"); $query_a = mysql_fetch_array($query); var_dump($query_a); The var_dump resulting from that is as follows; Code: [Select] array 0 => string 'Seltzer' (length=7) 'displayname' => string 'Seltzer' (length=7) Everything is working correctly, except for the fact that my database contains two displayname rows where rank is equal to one (EDIT: Two distinct rows). In fact, I can run a search of it in phpMyAdmin and get the two that my PHP code should be returning. phpMyAdmin generated the following query, which Inserted into my code in order to double-check things; Code: [Select] SELECT `displayname` FROM `login` WHERE `rank` =1 LIMIT 0 , 30 Even after I swapped my queries, the PHP code still returned the same var_dump as above. Complicating things further, I've noticed another function I've made, which queries "SELECT rank WHERE displayname = '$displayname'", functions perfectly. I've gotten rid of pretty much any source of the error I could think of; I'm testing the function on an otherwise empty page, I've removed any classes being used, and I've tried about a million different queries. Can someone help me out with this? I'm being held up by it and I'm sure that this is a simple fix. Thanks in advance, Dustin |