Jump to content

Search the Community

Showing results for tags 'mysql'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 278 results

  1. please help me inserting data to mysql database table from a html table. like <table> <tr> <td>name</td> <td>Gender</td> <td>age</td> <td>school</td> </tr> <tr> <td>John</td> <td>Male</td> <td>21</td> <td>Oxford</td> </tr> <tr> <td>Juliya</td> <td>Female</td> <td>25</td> <td>Oxford</td> </tr><!- bla! bla! bla! --></table>SUBMIT I want to send all the rows' data at once to a table. Please guide how could it be done!
  2. Hi, i want to make minimap of my world in game in canvas. I want to on this map could see where the points are the players. The map itself it would be screen over the world in my game. I suppose that the size reached by a few thousand pixels so was born the concept of the map was shifting. All of data will be downloading from database. How to make this? I don't have any ideas and I'm just a beginner in creating websites and web applications so please for your understanding and clear answers. I'll be very grateful and happy when someone help me to do such a thing.
  3. I have many select insert update query , i have written transaction query but want to know if its safe or some need to be corrected. Also if all is ok i should get successful "Transaction completed successfully!" , but if something get wrong then error message showed be seen and ROLLBACK should be done , but its NOT .... not rollback is done Below is what I have tried. Please let me know if something is wrong: function autocommitfalse(){global $db;return mysqli_autocommit($db, FALSE);}function autocommittrue(){global $db;return mysqli_autocommit($db, TRUE);}function commitquery(){global $db;return mysqli_commit($db);}function rollbackedquery(){global $db;return mysqli_rollback($db);} =============================================================================== try {global $db;autocommitfalse();-----------------$SQLSELECT = "SELECT * FROM BC ";$result_as = mysqli_query($db,$SQLSELECT);$rsfetch = mysql_fetch_array($result_as);if(!$result_as ){throw new Exception('Wrong SQL SELECT: ' . $SQLSELECT. ' Error: '.db_error_msg($db) . db_error_no());}-----------------$sqla ="INSERT INTO A (sd) VALUES ('df') where id=".$rsfetch['dh'];$result_a = mysqli_query($db,$sqla);if(!$result_a){throw new Exception('Wrong SQL SELECT: ' . $result_a. ' Error: '.db_error_msg($db) . db_error_no());}-----------------$sqlb ="INSERT INTO B (sdds) VALUES ('trtrt') where id=".$rsfetch['dh'];$result_b =mysqli_query($db,$sqlb);if(!$result_{throw new Exception('Wrong SQL SELECT: ' . $result_a. ' Error: '.db_error_msg($db) . db_error_no());}-----------------$a = mysqli_insert_id($db);-----------------$sqlCb ="UPDATE CB SET A ='NM' where id=".$a ;$result_Cb = mysqli_query($db,$sqlCb);if($result_Cb === false || mysqli_affected_rows($db) == 0 ){throw new Exception('Wrong SQL SELECT: ' . $result_a. ' Error: '.db_error_msg($db) . db_error_no());}-----------------commitquery();echo 'Transaction completed successfully!';} catch (Exception $e) {echo"<br >";echo "<table align=center><tr><td>";echo $e->getMessage();echo "</td></tr></table>";echo"<br >";echo display_error(_("Transaction failed: transaction rolled back"));rollbackedquery();}autocommittrue(); Please let me know its correct or not , if need to correct then what , as still not rollbacked with above code..
  4. Hey Guys, So, I know this information is all over the 'net...and I've scoured dozens of similar problems, however, none of the suggested fixes have helped for my code. So, I've turned back here... <? session_start(); ?><?php$email = $_SESSION['email'];$userid = $_SESSION['user_id'];include ('connect.php');$result = mysql_query("SELECT * FROM shadbarktest.mcn_users WHERE email = '$email'"); $row = mysql_fetch_array($result);// data sent from form $first_name = $_POST['first_name'];$last_name = $_POST['last_name'];$user_email = $_POST['email'];$address = $_POST['address'];$city = $_POST['city'];$state = $_POST['state'];$zip = $_POST['zip'];$phone = $_POST['phone'];$password = $_POST['password'];// To protect MySQL injection (more detail about MySQL injection)$first_name = stripslashes($first_name);$last_name = stripslashes($last_name);$user_email = stripslashes($user_email);$address = stripslashes($address);$city = stripslashes($city);$state = stripslashes($state);$zip = stripslashes($zip);$phone = stripslashes($phone);$password = stripslashes($password);$first_name = mysql_real_escape_string($first_name);$last_name = mysql_real_escape_string($last_name);$user_email = mysql_real_escape_string($user_email);$address = mysql_real_escape_string($address);$city = mysql_real_escape_string($city);$state = mysql_real_escape_string($state);$zip = mysql_real_escape_string($zip);$phone = mysql_real_escape_string($phone);$password = mysql_real_escape_string($password);// Adding information to Database$update = 'UPDATE mcn_users SET first_name = "$first_name", last_name = "$last_name", bill_address = "$address", city = "$city", state = "$state", zip = "$zip", phone = "$phone", email = "$user_email", user_pass = "$password" WHERE user_id = "$userid"';@mysql_query($update);$_SESSION['email'] = $user_email;echo $userid ."<br/>";echo $first_name ."<br/>";echo $last_name ."<br/>";echo "<a href="user_mainpage.php">Return</a>";?> It simply is not adding the updated information that it receives from the Edit User page to the database. Please point out to me where I've gone wrong:I have tried... NOTHING HAS WORKED...which leads me to question if I even have the syntax correct.
  5. Hello, new here and also sorta new to PHP and all that. I'm trying to find a way to select certain checkboxes and input that data into a database. And then at times go back and view and update the database. The checkboxes may also change at times and I do not want to go add a bunch of fields into the database just to see who's all in it. What I have so far is peoples names in a checkbox form where I can select names and submit it. It then implodes and inserts it into the database like so responders(2,4,47,56) Its not going to be a thing like responders(0,0,1,0) type thing. My format so I do not confuse people responders = row in mysql (numbers) = data in the field in my row Am I way overthinking this, or is there a very simple way to do this? Please note, the name list may update in the future as in names being added, I would like an easy way to add people without killing myself modifying my php/html files. If I lost you in anyway let me know I will see what I can do to make it not confusing.
  6. I wish to evaluate the tototal/sum of the sum column in the <tfoot> section of my table. I can't get the output correctly. my code is below. I shall appreciate any inputs. Take a look at the attached screen capture to better understand what i need to do. The total of the sum column in the table <tfoot> is what i need: <?phprequire_once('includes/connect.php');$result = mysqli_query($con, "SELECT studentid, hw1, hw2, hw3, SUM(hw1+hw2+hw3) as sum FROM scores GROUP BY studentid");echo "<table border='1'><thead> <tr> <th>StudentID</th> <th>HW1</th> <th>HW2</th> <th>HW3</th> <th>SUM</th> </tr></thead>";echo "<tfoot> <tr> <td>Total:</td> <td> echo SUM(sum);</td> </tr></tfoot>";while ($row = mysqli_fetch_array($result)){"<tbody> <tr>"; echo "<td>" . $row['studentid'] . "</td>"; echo "<td>" . $row['hw1'] . "</td>"; echo "<td>" . $row['hw2'] . "</td>"; echo "<td>" . $row['hw3'] . "</td>"; echo "<td>" . $row['sum'] . "</td>"; echo " </tr> </tbody>"; } echo "</table>"; mysqli_close($con);?> Thanks
  7. I am a beginner / intermediate MySQL user, but I need what I believe is a fairly advanced sql query, and I haven't been able to figure it out on my own. If someone could please help, I would really appreciate it. Here is my current query, and it IS returning valid data: $result = mysqli_query($con, "SELECT r.asset_title, r.alt_code, r.studio, r.type, r.start_win, r.end_win, r.rcv_date, r.pub_date, r.date_r4qc, r.qc_status, r.qc_notes, r.re_qc_date, r.promo_date, from_unixtime(ft.in_time) AS in_time, f.description AS description, left(ft.file_name, 20) FROM calendars r, tracker ft, folder f WHERE (r.alt_code = left(ft.file_name, 20) and ft.folder_id = f.id) limit 100"); Here's what I'm trying to accomplish: Most of the data that I need is in a single table, but there is one single field in each of two different tables, that I need to incorporate into my web output. The problem is, that the current status, and the date associated with that current status, are not sorted in any specific order. For each asset in the "calendars" table, I need to list all of the statuses, to include the "latest" status from the tracker table... In other words, for each asset in the "calendars" table, I need to look at the latest entries in the "tracker" table, then sort the "tracker" table output, returning the latest entry from that table. The above query IS returning valid data, but the data being returned from the tracker table is not always the latest data... How can I modify the above query to get just the latest entry from the tracker table? Again, any help would be greatly appreciated. Thanks in advance, and Merry Christmas to all... JCF
  8. Hello internet. My next task is to try and pull data from mysql using PHP and place that information into a table in a PDF file format. Everything I have found when I searched on the topic leads me to believe this is an extremely advanced form of coding and I am certainly not on that level. Is there software or something out there that you can point me to, to help create these PDF files from data in mysql?
  9. Okay, so, it was working...now it doesn't. PLEASE HELP! NEED IT WORKING TODAY!!! require ('connect.php');$myusername = $_SESSION['myusername'];//Data from Clients table and variables associate$client_table = mysql_query("SELECT * FROM `clients` WHERE client_id = ". $_SESSION['clientid'] ." ") or die(mysql_error());$row = mysql_fetch_assoc($client_table);//Data from Payments table and variables associated$pmt_table = mysql_query("SELECT * FROM `payments` WHERE client_id = ". $_SESSION['clientid'] ." ORDER BY YEAR(pmt_date) ASC") or die(mysql_error());$row2 = mysql_fetch_assoc($pmt_table);$userstate = $row2['userstate']; The ENTIRE report.php file is dependent upon information from the database that carried over via Session from the client's information page with a unique ID number that corresponds to the client_id in the database. I can access all the information in the client info.php, but it's like it doesn't carry over. Please help ASAP!
  10. Hello.I have this code $get_cart_info = mysql_query("select c.*,g.*,m.* from cart as c left join games as g on c.tid = g.id left join movies as m on c.tid=m.id where c.user = {$CURUSER['id']} GROUP BY c.tid") or die(mysql_error()); But what I need is when c.type is movie its only takes info from movies tabel, but still have to take everything out, because I both have movies and games in cart..Can it be done, or do I have to trying something else?
  11. udaikr

    Error in database

    hello friends i am new in php ,want to add form with database ,but a error appeared , ( ! ) Notice: Undefined variable: name in C:wampwwwyour_mailregister.php on line 26 Call Stack # Time Memory Function Location 1 0.0521 142664 {main}( ) ..register.php:0 ( ! ) Notice: Undefined variable: email in C:wampwwwyour_mailregister.php on line 26 Call Stack # Time Memory Function Location 1 0.0521 142664 {main}( ) ..register.php:0 this is my code can anyone help me. if(isset($_POST['name'])){ $name = $_POST['name']; $email = $_POST['email']; $password = $_POST['password']; } $query = "INSERT INTO users (id,name,email,password,added_date,modified_date,status) VALUES ('','$name','$email','$password','NOW()','','0') ";
  12. Hi Friends, I am having some situation here. I am having data like this... "JOB_FINISH" "7.06" 1375105341 787452 22967 503578631 1 1374645973 0 0 1374645973 "mallikas" "batch" "select[ ((type==X64LIN && osrel==50 && clearcase)||(type==X32LIN && osrel==50 && clearcase))]" "" "" "blrlc275" "/home/padbgl/c11t_m6p60_2v5_Iw6/nodm/default/units/top/simulation/titan/FE/TB_IN_CSEA" "" "" "" "1374645973.787452" [i][u][b]2 "blrlc245+" "others" 1 "blrlc245"[/b][/u][/i] 32 225.0 "INWAY_NANOSIM" "/home/padbgl/bin/prjgate -e -- /home/mallikas/.lsbatch/blrlc275.28492.0.1374645972.NANOSIM" 3.542461 2.000000 39952 0 -1 0 0 21904 13 0 0 0 -1 0 0 0 15028 170 -1 "" "padbgl_c11t_m6p60_2v5_Iw6" 256 1 "" "" 0 52288 272924 "" "" "" "" 0 "" 0 "" -1 "/mallikas" "" "" "" -1 "" "" 5136 "" 1374645973 "" "" 0"JOB_FINISH" "7.06" 1375105342 793353 22967 503578626 1 1374826659 0 0 1374826659 "mallikas" "batch" "select[ ((type==X64LIN && osrel==50 && clearcase)||(type==X64LIN && osrel==40 && clearcase))]" "" "" "blrlc275" "/home/padbgl/c11t_m6p60_2v5_Iw6/nodm/default/units/top/milkyway_2010.03/4m_MQLB/source" "" "" "" "1374826659.793353" [u][i][b]0 1 "blrlc266"[/b][/i][/u] 32 225.0 "" "/home/padbgl/bin/prjgate -e -- /home/mallikas/.lsbatch/blrlc275.24538.0.1374826658.DEFAULT" 0.012998 0.014997 0 0 -1 0 0 414 0 0 0 0 -1 0 0 0 21 1 -1 "" "padbgl_c11t_m6p60_2v5_Iw6" 9 1 "" "" 0 70372 200640 "" "" "" "" 0 "" 17 "" -1 "/mallikas" "" "" "" -1 "" "" 5136 "" 1374826659 "" "" 0 The real problem is with those four fields where i have underlined.1. when the first field is 0, the logger is skipping to enter an empty string '' there which makes other fields popping into their previous fields.2. When the first filed is 2 or more the logger is giving them in separate string like 2 'blrlc245+' 'others' which is supposedly to be like 2 'blrlc245+others' which makes the rest of the fields move right as many new columns created by logger for one field. Is there any way to regularize this and add files into the database using LOAD DATA INFILE command ? [ as of now it is giving random values for the columns after this fields because of this irregularity ] Hoping for help
  13. hi there, the following query was developed and works as it should. SELECT ( SELECT COUNT(DISTINCT SP1.bigint_ProspectID, PLS1.smallint_ProspectOrdinal) FROM 10_serviceprospects SP1 LEFT JOIN 13_prospectleadsent PLS1 ON SP1.bigint_ProspectID = PLS1.bigint_ProspectID WHERE PLS1.timestamp_Sent BETWEEN "2013-08-01 00:00:00" AND "2013-08-30 23:59:59" AND SP1.bigint_ServiceID = SS.bigint_ServiceID AND PLS1.bigint_SupplierID = S.bigint_SupplierID ) AS `Previous Month`, ( SELECT COUNT(DISTINCTROW SP2.bigint_ProspectID, PLS2.smallint_ProspectOrdinal) FROM 10_serviceprospects SP2 LEFT JOIN 13_prospectleadsent PLS2 ON SP2.bigint_ProspectID = PLS2.bigint_ProspectID WHERE PLS2.timestamp_Sent BETWEEN "2013-09-01 00:00:00" AND "2013-09-31 23:59:59" AND SP2.bigint_ServiceID = SS.bigint_ServiceID AND PLS2.bigint_SupplierID = S.bigint_SupplierID ) AS `Last Month`, ( SELECT COUNT(DISTINCT SP3.bigint_ProspectID, PLS3.smallint_ProspectOrdinal, PLS3.bigint_SupplierID) FROM 10_serviceprospects SP3 LEFT JOIN 13_prospectleadsent PLS3 ON SP3.bigint_ProspectID = PLS3.bigint_ProspectID WHERE PLS3.timestamp_Sent BETWEEN "2013-10-01 00:00:00" AND "2013-10-30 23:59:59" AND SP3.bigint_ServiceID = SS.bigint_ServiceID AND PLS3.bigint_SupplierID = S.bigint_SupplierID ) AS `Current Month`, ( SELECT COUNT(DISTINCT SP0.bigint_ProspectID, PLS0.smallint_ProspectOrdinal) FROM 10_serviceprospects SP0 LEFT JOIN 13_prospectleadsent PLS0 ON SP0.bigint_ProspectID = PLS0.bigint_ProspectID WHERE PLS0.timestamp_Sent BETWEEN "2013-08-01 00:00:00" AND "2013-10-30 23:59:59" AND SP0.bigint_ServiceID = SS.bigint_ServiceID AND PLS0.bigint_SupplierID = S.bigint_SupplierID ) AS `Total`, S.text_SupplierName AS `Supplier Name` FROM 5_suppliers S JOIN 4_servicesuppliers SS ON (S.bigint_SupplierID = SS.bigint_SupplierID) WHERE SS.bigint_ServiceID = 1 # Bakkie Canopies OnlyAND S.smallint_SupplierStatus = 4 # Freemium Suppliers OnlyGROUP BY S.bigint_SupplierID ORDER BY `Total` DESC, `Supplier Name` ASC; # Order by Total, then Supplier Name took about a day to develop this inbetween other work. it returns the correct data. the output is available at https://performatix.co/csv/Bakkie_Canopies_Freemium_Supplier_Opportunities_2013-10-09.csv i was then requested to change the ordering by `Total` and primarily by `Region Description`; as well as grouping by Region ID and primarily by Supplier ID, creating a secondary output. SELECT R.text_RegionDescription AS `Region Description`, ( SELECT COUNT(DISTINCT SP1.bigint_ProspectID, PLS1.smallint_ProspectOrdinal) FROM 10_serviceprospects SP1 LEFT JOIN 13_prospectleadsent PLS1 ON SP1.bigint_ProspectID = PLS1.bigint_ProspectID WHERE PLS1.timestamp_Sent BETWEEN "2013-08-01 00:00:00" AND "2013-08-30 23:59:59" AND SP1.bigint_ServiceID = SS.bigint_ServiceID AND PLS1.bigint_SupplierID = S.bigint_SupplierID AND SP1.bigint_RegionID = R.bigint_RegionID ) AS `Previous Month`, ( SELECT COUNT(DISTINCTROW SP2.bigint_ProspectID, PLS2.smallint_ProspectOrdinal) FROM 10_serviceprospects SP2 LEFT JOIN 13_prospectleadsent PLS2 ON SP2.bigint_ProspectID = PLS2.bigint_ProspectID WHERE PLS2.timestamp_Sent BETWEEN "2013-09-01 00:00:00" AND "2013-09-31 23:59:59" AND SP2.bigint_ServiceID = SS.bigint_ServiceID AND PLS2.bigint_SupplierID = S.bigint_SupplierID AND SP2.bigint_RegionID = R.bigint_RegionID ) AS `Last Month`, ( SELECT COUNT(DISTINCT SP3.bigint_ProspectID, PLS3.smallint_ProspectOrdinal, PLS3.bigint_SupplierID) FROM 10_serviceprospects SP3 LEFT JOIN 13_prospectleadsent PLS3 ON SP3.bigint_ProspectID = PLS3.bigint_ProspectID WHERE PLS3.timestamp_Sent BETWEEN "2013-10-01 00:00:00" AND "2013-10-30 23:59:59" AND SP3.bigint_ServiceID = SS.bigint_ServiceID AND PLS3.bigint_SupplierID = S.bigint_SupplierID AND SP3.bigint_RegionID = R.bigint_RegionID ) AS `Current Month`, ( SELECT COUNT(DISTINCT SP0.bigint_ProspectID, PLS0.smallint_ProspectOrdinal) FROM 10_serviceprospects SP0 LEFT JOIN 13_prospectleadsent PLS0 ON SP0.bigint_ProspectID = PLS0.bigint_ProspectID WHERE PLS0.timestamp_Sent BETWEEN "2013-08-01 00:00:00" AND "2013-10-30 23:59:59" AND SP0.bigint_ServiceID = SS.bigint_ServiceID AND PLS0.bigint_SupplierID = S.bigint_SupplierID AND SP0.bigint_RegionID = R.bigint_RegionID ) AS `Total`, S.text_SupplierName AS `Supplier Name` FROM 5_suppliers S JOIN 4_servicesuppliers SS ON (S.bigint_SupplierID = SS.bigint_SupplierID) JOIN 1_regions R ON (SS.bigint_RegionID = R.bigint_RegionID)WHERE SS.bigint_ServiceID = 1 # Bakkie Canopies OnlyAND S.smallint_SupplierStatus = 4 # Freemium Suppliers OnlyGROUP BY SS.bigint_RegionID, SS.bigint_SupplierID ORDER BY `Total` DESC, `Region Description` ASC; # Order by Total, then Region Description this took about an hour inbetween other work. the results are in https://performatix.co/csv/Bakkie_Canopies_Regional_Freemium_Supplier_Opportunities_2013-10-09.csv however you will notice that the values do not corroborate with the first (this was discovered recently after reviewing the csv's! what is wrong with this query to get it to corroborate with the first?). i was then asked to order by `Total` but primarily by `Region Description`, and group by Region ID - creating a third output. SELECT R.text_RegionDescription AS `Region Description`, ( SELECT COUNT(DISTINCT SP1.bigint_ProspectID, PLS1.smallint_ProspectOrdinal) FROM 10_serviceprospects SP1 LEFT JOIN 13_prospectleadsent PLS1 ON SP1.bigint_ProspectID = PLS1.bigint_ProspectID WHERE PLS1.timestamp_Sent BETWEEN "2013-08-01 00:00:00" AND "2013-08-30 23:59:59" AND SP1.bigint_ServiceID = SS.bigint_ServiceID AND PLS1.bigint_SupplierID = S.bigint_SupplierID AND SP1.bigint_RegionID = R.bigint_RegionID ) AS `Previous Month`, ( SELECT COUNT(DISTINCTROW SP2.bigint_ProspectID, PLS2.smallint_ProspectOrdinal) FROM 10_serviceprospects SP2 LEFT JOIN 13_prospectleadsent PLS2 ON SP2.bigint_ProspectID = PLS2.bigint_ProspectID WHERE PLS2.timestamp_Sent BETWEEN "2013-09-01 00:00:00" AND "2013-09-31 23:59:59" AND SP2.bigint_ServiceID = SS.bigint_ServiceID AND PLS2.bigint_SupplierID = S.bigint_SupplierID AND SP2.bigint_RegionID = R.bigint_RegionID ) AS `Last Month`, ( SELECT COUNT(DISTINCT SP3.bigint_ProspectID, PLS3.smallint_ProspectOrdinal, PLS3.bigint_SupplierID) FROM 10_serviceprospects SP3 LEFT JOIN 13_prospectleadsent PLS3 ON SP3.bigint_ProspectID = PLS3.bigint_ProspectID WHERE PLS3.timestamp_Sent BETWEEN "2013-10-01 00:00:00" AND "2013-10-30 23:59:59" AND SP3.bigint_ServiceID = SS.bigint_ServiceID AND PLS3.bigint_SupplierID = S.bigint_SupplierID AND SP3.bigint_RegionID = R.bigint_RegionID ) AS `Current Month`, ( SELECT COUNT(DISTINCT SP0.bigint_ProspectID, PLS0.smallint_ProspectOrdinal) FROM 10_serviceprospects SP0 LEFT JOIN 13_prospectleadsent PLS0 ON SP0.bigint_ProspectID = PLS0.bigint_ProspectID WHERE PLS0.timestamp_Sent BETWEEN "2013-08-01 00:00:00" AND "2013-10-30 23:59:59" AND SP0.bigint_ServiceID = SS.bigint_ServiceID AND PLS0.bigint_SupplierID = S.bigint_SupplierID AND SP0.bigint_RegionID = R.bigint_RegionID ) AS `Total`FROM 5_suppliers S JOIN 4_servicesuppliers SS ON (S.bigint_SupplierID = SS.bigint_SupplierID) JOIN 1_regions R ON (SS.bigint_RegionID = R.bigint_RegionID)WHERE SS.bigint_ServiceID = 1 # Bakkie Canopies OnlyAND S.smallint_SupplierStatus = 4 # Freemium Suppliers OnlyGROUP BY SS.bigint_RegionID ORDER BY `Total` DESC, `Region Description` ASC; # Order by Total, then Region Description this took approximately another hour between other work. the results are in https://performatix.co/csv/Bakkie_Canopies_Regional_Freemium_Supplier_Opportunities_2013-10-09.csv once again - the data does not corroborate with the first csv, the issue i am facing is that i do not understand why the queries are not synchronous to the data... the first query works just as well for a different service, however the second and third queries do not return anything at all. i am assuming that this is because they do not have varying regions (all the same). further than this i just keep hitting my head... anyone comfortable enough to have a look at the queries and suggest changes other than the ones i applied? the data from the tables are available at https://performatix.co/csv/1_regions, 2_servicescatalogue, 4_servicesuppliers, 5_suppliers, 10_serviceprospects & 13_prospectleadsent.csv.
  14. Hey everyone! I know this is possible and i bookmarked the code to do this but i can not find it for the life of me. Here is what i need. I am looking for a code that will get new entries (ones that are not all ready on the page) from mysql db then display them on the current page with out refreshing. I am just wanting a simple one. I just want it to display the data in a new div with in a existing div. My server does NOT support ajax, can any one help me please!?
  15. Hey guys. I need a little help. I am working on a site that is requiring me to do something a little fancier then i know how to do. let me explain. When my web admin is loged in to there is and they are editing a page (say there home page) and they want to add content to there home page. They would do the following. (see picture attachment as well.) Click the Add content div (div with a + symbol in it) A Pop up comes up asking them what kind of content would you like to add. (text, picture. html) User selects a option (text for this example) the popup window now changes to a forum input box (meaning the popup never closes just the content in the pop changes from option select to data input). once the user has entered there data they click submit the data is then added to the db and the popup closes and the user is brought back to there page they were working on which has the new content added to the page. I would think this would have something to do with Jquerry or does php handle this? Like i said this is all new to me and im trying to learn how to do this. I would like to use PHP, jquerry, mysql and javascript my server does not support asp. Any help would be greatly appreciated! PS: sorry if i posted this in the wrong section, this just seamed like the best fit.
  16. Hi, i was wondering how to move a image over a 9x9 grid of other images The 9x9 would be 81 images of a size, lets say 32px by 32px The images that moves over them the same size 32x32. The 9x9 would be the background and the image that needs to be moved should stay centered. In what direction should i look, and are there any tutorials on the mather ? i was thinking that if i move the background the image would always stay centered but i dont know i that is a good idea. an exemple would be http://www.pardus.at or http://sylfex.redirectme.net
  17. lipe009

    Seats booking system

    So, i made a seat booking system where there are checkboxes in every seat and the user select this boxes and the seats are considered reserved. But now i want make the user be able to give each marked seat a name. How can i do that? seats.php <html><head><title>Tickets</title><style>* {font-size: 11px;font-family: arial;}</style><script>function reserveSeats() {var selectedList = getSelectedList('Reserve Seats');if (selectedList) {if (confirm('Do you want to reserveselected seat/s ' + selectedList + '?')) {document.forms[0].oldStatusCode.value=0;document.forms[0].newStatusCode.value=1;document.forms[0].action='bookseats.php';document.forms[0].submit();} else {clearSelection();}}}function cancelSeats() {var selectedList = getSelectedList('Cancel Reservation');if (selectedList) {if (confirm('Do you want to cancel reserved seat/s ' + selectedList + '?')) {document.forms[0].oldStatusCode.value=1;document.forms[0].newStatusCode.value=0;document.forms[0].action='bookseats.php';document.forms[0].submit();} else {clearSelection();}}}function confirmSeats() {var selectedList = getSelectedList('Confirm Reservation');if (selectedList) {if (confirm('Do you want to confirm reserved seat/s ' + selectedList + '?')) {document.forms[0].oldStatusCode.value=1;document.forms[0].newStatusCode.value=2;document.forms[0].action='bookseats.php';document.forms[0].submit();} else {clearSelection();}}}function getSelectedList(actionSelected) {// get selected listvar obj = document.forms[0].elements;var selectedList = '';for (var i = 0; i < obj.length; i++) {if (obj[i].checked && obj[i].name == 'seats[]') {selectedList += obj[i].value + ', ';}}// no selection errorif (selectedList == '') {alert('Please select a seat before clicking ' + actionSelected);return false;} else {return selectedList;}}function clearSelection() {var obj = document.forms[0].elements;for (var i = 0; i < obj.length; i++) {if (obj[i].checked) {obj[i].checked = false;}}}function refreshView() {clearSelection();document.forms[0].action='<?php echo $_SERVER['PHP_SELF']; ?>';document.forms[0].submit();}</script></head><body><table><tr><td width="100%" align="center"><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><input type="hidden" name="oldStatusCode" value=""/><input type="hidden" name="newStatusCode" value=""/><table width='100%' border='0'><tr><td align='center'><input type='button' value='Refresh View' onclick='refreshView();'/></td></tr></table></td></tr><tr><td width="100%" align="center"><table width='100%' border='0'><tr><td align='center'><input type='button' value='Reserve Seats' onclick='reserveSeats()'/> <input type='button' value='Confirm Reservation' onclick='confirmSeats()'/> <input type='button' value='Cancel Reservation' onclick='cancelSeats()'/></td></tr></table></td></tr><tr><td width="100%" align="center"><table width='100%' border='0'><tr><td align='center'><input type='button' value='Clear Selection' onclick='clearSelection()'/></td></tr></table></td></tr><tr><td width="100%" align="center"><?php$linkID = @ mysql_connect("localhost", "tickets", "tickets") or die("Could not connect to MySQL server");@ mysql_select_db("tickets") or die("Could not select database");/* Create and execute query. */$query = "SELECT * from seats order by rowId, columnId desc";$result = mysql_query($query);$prevRowId = null;$seatColor = null;$tableRow = false;//echo $result;echo "<table width='100%' border='0' cellpadding='3' cellspacing='3'>";while (list($rowId, $columnId, $status, $updatedby) = mysql_fetch_row($result)){if ($prevRowId != $rowId) {if ($rowId != 'A') {echo "</tr></table></td>";echo "n</tr>";}$prevRowId = $rowId;echo "n<tr><td align='center'><table border='1' cellpadding='8' cellspacing='8'><tr>";} else {$tableRow = false;}if ($status == 0) {$seatColor = "lightgreen";} else if ($status == 1 && $updatedby == 'user1') {$seatColor = "FFCC99";} else if ($status == 1 && $updatedby == 'user2') {$seatColor = "FFCCFF";} else if ($status == 2 && $updatedby == 'user1') {$seatColor = "FF9999";} else if ($status == 2 && $updatedby == 'user2') {$seatColor = "CC66FF";} else {$seatColor = "red";}echo "n<td bgcolor='$seatColor' align='center'>";echo "$rowId$columnId";if ($status == 0 || ($status == 1 && $updatedby == $_SERVER['PHP_AUTH_USER'])) {echo "<input type='checkbox' name='seats[]' value='$rowId$columnId'></checkbox>";}echo "</td>";if (($rowId == 'A' && $columnId == 7) || ($rowId == 'B' && $columnId == 9) || ($rowId == 'C' && $columnId == 9) || ($rowId == 'D' && $columnId == 10) || ($rowId == 'E' && $columnId == 8) || ($rowId == 'F' && $columnId == 5) || ($rowId == 'G' && $columnId == 13) || ($rowId == 'H' && $columnId == 14) || ($rowId == 'I' && $columnId == 14) || ($rowId == 'J' && $columnId == 12) || ($rowId == 'K' && $columnId == 14) || ($rowId == 'L' && $columnId == 13) || ($rowId == 'M' && $columnId == 9)) {// This fragment is for adding a blank cell which represent the "center aisle"echo "<td> </td>";}}echo "</tr></table></td>";echo "</tr>";echo "</table>";/* Close connection to database server. */mysql_close();?></td></tr><tr><td> </td></tr><tr><td width="100%" align="center"><table border="1" cellspacing="8" cellpadding="8"><tr><td bgcolor='lightgreen'>Available</td><td bgcolor='FFCC99'>Reserved user1</td><td bgcolor='FF9999'>Confirmed user1</td><td bgcolor='FFCCFF'>Reserved user2</td><td bgcolor='CC66FF'>Confirmed user2</td></tr></table></td></tr><tr><td> </td></tr><tr><td width="100%" align="center"><a href="seatplan.jpg" target="new">View Layout</a> </td></tr></table></form></body></html> bookseats.php <html><head><title>Book Seats</title><style>* {font-size: 14px;font-family: arial;}</style></head><body><center><br/><br/><br/><?phpif (isset($_POST['seats'])){$user = $_SERVER['PHP_AUTH_USER'];$newStatusCode = $_POST['newStatusCode'];$oldStatusCode = $_POST['oldStatusCode'];// open database connection$linkID = @ mysql_connect("localhost", "tickets", "tickets") or die("Could not connect to MySQL server");@ mysql_select_db("tickets") or die("Could not select database");// prepare select statement$selectQuery = "SELECT rowId, columnId from seats where (";$count = 0;foreach($_POST['seats'] AS $seat) {if ($count > 0) {$selectQuery .= " || ";}$selectQuery .= " ( rowId = '" . substr($seat, 0, 1) . "'";$selectQuery .= " and columnId = " . substr($seat, 1) . " ) ";$count++;}$selectQuery .= " ) and status = $oldStatusCode";if ($oldStatusCode == 1) {$selectQuery .= " and updatedby = '$user'";}//echo $selectQuery;// execute select statement$result = mysql_query($selectQuery);//echo $result;$selectedSeats = mysql_num_rows($result);//echo "<br/>" . $selectedSeats;if ($selectedSeats != $count) {$problem = "<h3>There was a problem executing your request. No seat/s were updated.</h3>";$problem .= "Possible problems are:";$problem .= "<ul>";$problem .= "<li>Another process was able to book the same seat while you were still browsing.</li>";$problem .= "<li>You were trying to Confirm an unreserved Seat.</li>";$problem .= "<li>You were trying to Cancel an unreserved Seat.</li>";$problem .= "<li>You were trying to Reserve a reserved Seat.</li>";$problem .= "<li>There was a problem connecting to the database.</li>";$problem .= "</ul>";$problem .= "<a href='seats.php'>View Seat Plan</a>";die ($problem);}// prepare update statement$newStatusCode = $_POST['newStatusCode'];$oldStatusCode = $_POST['oldStatusCode'];$updateQuery = "UPDATE seats set status=$newStatusCode, updatedby='$user' where ( ";$count = 0;foreach($_POST['seats'] AS $seat) {if ($count > 0) {$updateQuery .= " || ";}$updateQuery .= " ( rowId = '" . substr($seat, 0, 1) . "'";$updateQuery .= " and columnId = " . substr($seat, 1) . " ) ";$count++;}$updateQuery .= " ) and status = $oldStatusCode";if ($oldStatusCode == 1) {$updateQuery .= " and updatedby = '$user'";}// perform update$result = mysql_query($updateQuery);$updatedSeats = mysql_affected_rows();if ($result && $updatedSeats == $count) {//$mysql->commit();include ('reservapt2.php');} else {//$mysql->rollback();echo "<h3>There was a problem executing your request. No seat/s were updated.</h3>";echo "Possible problems are:";echo "<ul>";echo "<li>Another process was able to book the same seat while you were still browsing.</li>";echo "<li>You were trying to Confirm an unreserved Seat.</li>";echo "<li>You were trying to Cancel an unreserved Seat.</li>";echo "<li>You were trying to Reserve a reserved Seat.</li>";echo "<li>There was a problem connecting to the database.</li>";echo "</ul>";}echo "<a href='seats.php'>View Seat Plan</a>";// Enable the autocommit feature//$mysqldb->autocommit(TRUE);// Recuperate the query resources//$result->free();mysql_close();}?></center></body></html> ----------------------------- I tried the following: When the user submit the checkboxes, this is included: name.php <?php//$mysql->commit();session_start();$_SESSION['rowId'] = $_POST['rowId'];$_SESSION['columnId'] = $_POST['columnId'];echo "<h3>";echo "Please enter the name for each seat:<br><p> </p>";echo "";foreach($_POST['seats'] AS $seat) {$rowId = substr($seat, 0, 1);$columnId = substr($seat, 1);echo $rowId . $columnId . '</br><form method="post" name="input" action="pt2.php" ><input name="name" type="text"/></br>';}?><input type="submit" name="Submit" value="insert" /></form> pt2.php: <?php// Connect to MySQLmysql_connect("localhost", "root", "root") or die("Connection Failed");mysql_select_db("tickets")or die("Connection Failed");$name = $_POST['name'];session_start();$rowId = $_SESSION['rowId'];$columnId = $_SESSION['columnId'];$result = mysql_query("UPDATE seats SET updatedby='".$name."' WHERE rowId='".$rowId."' AND columnId='".$columnId."'") or die(mysql_error()); ?> If the user selects only one seat, this code works like a charm. But when there's two or more, the $columnId and the $rowId doesn't change as it should, and only the name of the last checked seat is changed. Does anybody knows how i can solve this?
  18. Ok, so i still work with the whole thing, but this is what i try to figure out. 1. LOOK AT UPLOADED PICTURE FOR SEEING MY DESIGN! 2. as you see, i have only made the css/html part (a danish website (own project)) and the box to left (with the loading-bar), a simple image. I was wondering if anyone in here knew how to change the html text under it like (Data OK) or something like that if the username we got back was true and OK before moving on to the index.php page?.. 3. just to clarifie, it's an user-login page i am trying to figure out here ... 4. This is my whole takelogin.php file: <?phprequire_once ("include/core.php");require_once ("include/password_functions.php");require_once ("include/boxes.php");get_template();dbconn();$HTMLOUT = "";//starting var...$stdhead = array(// include css 'css' => array( 'side_boxes', 'boxes_signup' ));$stdfoot = array(// include js 'js' => array());$HTMLOUT .= "<div class='wrapper_signup_div'>";//MAIN INDEX WRAPPER START...//============================//START LEFT DIV CONTAINER...$HTMLOUT .= "<div class='left_signup_div'>";$HTMLOUT .= box_start("Sender data..."); $HTMLOUT .= "<center><img src='templates/".$PF['style']."/images/login_loader.gif'></center>";$HTMLOUT .= box_end();$HTMLOUT .= "</div>";//ENDING LEFT DIV CONTAINER...//============================//============================//START RIGHT DIV CONTAINER...$HTMLOUT .= "<div class='right_signup_div'>";$HTMLOUT .= box_start(); $HTMLOUT .= "Tjekker info i databasen og sender dig videre hvis det er korrekt...<br /><br />"; $HTMLOUT .= "Hvis intet sker inden 5 sekunder, klik <a href='#'>her</a>";$HTMLOUT .= box_end();//==========RUN LOGIN PROCEDURE=============== $uname = $_POST['username']; //Form Names... $pass = $_POST['password']; //Form Names... if(isset($pass) !== "") { $passhash = md_5($pass); //*Securing The Data... } $query = "SELECT * FROM users WHERE username = " . sqlesc($uname) . " AND passhash = " . sqlesc($passhash) . " AND enabled = 'yes' AND status = 'confirmed'"; //exit($query); // <-- debug if the query is as it should be $query_result = mysql_query($query)or die(mysql_error());//Running query to the DB...//$HTMLOUT .= "Username = " . $uname . "<br />";//$HTMLOUT .= "pass = " . $pass . "<br />";//$HTMLOUT .= "MD5 pass = " . $passhash . "<br />";//$HTMLOUT .= "Query = " . $query . "<br />";//$HTMLOUT .= "Query Result = " . $query_result . "<br />"; if(mysql_num_rows($query_result) > 0)//if the DB returns somfthing, then run... { $row = mysql_fetch_array($query_result, MYSQL_ASSOC); if(isset($_POST['cookie_login'])) { //$HTMLOUT .= "Cookie Login..."; logincookie($row['u_id'], $row['passhash'], true); }else{ //$HTMLOUT .= "Session Login..."; login_session($row['u_id'], $row['passhash'], true); }//ending else statement... header('Refresh: 3; url=index.php');//with time delay... } else//Error messeage... { $HTMLOUT .= "<hr /><center>Enten er kodeord forkert, ellers er brugernavnet forkert...</center>"; header('Refresh: 3; url=login.php');//with time delay... } //header("Location: index.php"); //header('Refresh: 3; url=index.php');//with time delay...//==========RUN LOGIN PROCEDURE===============$HTMLOUT .= "</div>";//ENDING RIGHT DIV CONTAINER...//============================$HTMLOUT .= "</div>";//MAIN INDEX WRAPPER END...print stdhead('Logger ind...' , $stdhead) . $HTMLOUT . stdfoot($stdfoot);?> Note that the PHP-LOGIN part is still being developed.. i just need to know if anyone could be helpfull and give me a smaller clue about what or where to look for a peace of jQuery code that looks like the thing i am trying to do... if you dont understand me as always (lol x)), then comment, and i will try to re-explain in details and best i can. -Thanks in advance as always!
  19. dedi

    upload many files

    I want to upload multiple files only with php.for example like my picture.when pressing the Add button, the file appears under the Add button.and after selecting a file, press the update button when the data is saved to the database.I want your help.I was confused to find references to complete my work.thank you
  20. I would like to create a stored routine for MySQL that figures out the number of business or working days for a month (Working Days are Monday thru Friday). I have not created the procedure portion of it yet as I want to ensure that the code works first. Please note that there is a function called first_day. This is a function provided by my hosting provider. I also have another function for this that will figure out the first day of the month if I didn't have it from the hosting company. It is not currently used and can be removed for testing purposes. I am testing this through phpmyadmin SQL Query. phpmyadmin uses the mysql extension and not the mysqli extension processing if that makes a difference. (The hosting company refuses to update it). It's a syntax error however I don't know what the syntax error is. All it tells me is: 1064 - 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 'WHILE(@daycount < @totaldays) DO IF (WEEKDAY(@checkweekday) < 6) THEN ' at line 2 My Syntax Error is in the following: WHILE(@daycount < @totaldays) DO IF (WEEKDAY(@checkweekday) < 6) THEN My Code: SELECT MONTH(CURDATE()) INTO @curmonth; SELECT MONTHNAME(CURDATE()) INTO @curmonthname; SELECT DAY(LAST_DAY(CURDATE())) INTO @totaldays; SELECT FIRST_DAY(CURDATE()) INTO @checkweekday; SELECT DAY(@checkweekday) INTO @checkday; SET @daycount = 0; SET @workdays = 0; BEGIN WHILE(@daycount < @totaldays) DO IF (WEEKDAY(@checkweekday) < 6) THEN SET @workdays = @workdays+1; END IF; SET @daycount = @daycount+1; SELECT ADDDATE('@checkweekday', INTERVAL 1 DAY) INTO @checkweekday; END WHILE; END; SELECT @workdays; I receive the same error with the following bit of code so it probably has something to do with this: SET @workdays = 0; IF (WEEKDAY('2013-06-13') < 6) THEN SET @workdays = @workdays+1; END IF; SELECT @workdays; Is someone able to assist?
  21. I have a log in script: <?phpsession_start();require ('connect.php'); // Connect to server and select databse.mysql_connect("$host", "$login", "$pass")or die("cannot connect");mysql_select_db("$db_name")or die("cannot select DB"); // Define $myusername and $mypassword$myusername=$_POST['username'];$mypassword=$_POST['password']; // To protect MySQL injection (more detail about MySQL injection)$myusername = stripslashes($myusername);$mypassword = stripslashes($mypassword);$myusername = mysql_real_escape_string($myusername);$mypassword = mysql_real_escape_string($mypassword);$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";$result=mysql_query($sql); // Mysql_num_row is counting table row$count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 rowif($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION["myusername"] = $myusername; $_SESSION["mypassword"] = $mypassword; header("location:/login/login_success.php");}else { echo "Wrong Username or Password";}?> When I log in for the FIRST time, it "logs in" but not correctly. It doesn't show user-specific information until I log out then log back in and it works. It does something similar when I have it go to a Report page. I have to "Go Back" and then click the Report again before it shows the correct information. Any suggestions why it's doing that???
  22. ok, just quick... im getting this when trying to login: Unknown column 'e5035533a816cac4c54012281f58543d' in 'where clause' and this is my takelogin.php file: /*==========RUN LOGIN PROCEDURE===============*/$uname = sqlesc($_POST['username']); /*Form Names...*/$pass = sqlesc($_POST['password']); /*Form Names...*/if(isset($pass)){$passhash = md_5($pass); /*Securing The Data...*/}$query = "SELECT * FROM users WHERE username = $uname AND passhash = $passhash AND enabled = 'yes' AND status = 'confirmed'";$query_result = mysql_query($query)or die(mysql_error());//Running query to the DB...if(mysql_num_rows($query_result) == 1)/*if the DB returns somfthing, then run...*/{$row = mysql_fetch_array($query_result);$_SESSION['uid'] = $row['u_id'];$_SESSION['username'] = $row['username'];$_SESSION['pass'] = $row['passhash'];$_SESSION['status'] = $row['status'];$_SESSION['enabled'] = $row['enabled'];$_SESSION['email'] = $row['email'];$_SESSION['ip'] = $row['ip'];$_SESSION['class'] = $row['class'];$_SESSION['time_offset'] = $row['time_offset'];$_SESSION['dst_in_use'] = $row['dst_in_use'];$_SESSION['auto_correct_dst'] = $row['auto_correct_dst'];header('Refresh: 3; url=index.php');//with time delay...}else/*Error messeage...*/{$HTMLOUT .= "<center>Error reading login-session coding base, or a wrong username/pass inserted...</center>";header('Refresh: 3; url=index.php');//with time delay...}/*==========RUN LOGIN PROCEDURE===============*/ any ideas? Oo...
  23. Hello internet. I am trying to place the local time in a php table using the code below - it executes but is not displaying the local time EST that I would like - it is still displaying GMT. What am I doing wrong here? Table is ViewColumn for date in mysql is TStampAuto Increment column is M_idgru references with a 3 which is the gru number where I send the persons comments to the Cmnts column //code$result = mysql_query("SELECT * FROM View WHERE gru='3' AND DATE_ADD(NOW(), INTERVAL 2 HOUR) > TStamp ORDER BY M_id DESC");echo "<table border='0'><tr><th>Name</th><th>Comments</th><th>Date & Time</th></tr>";while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['NameC'] . "</td>"; echo "<td>" . $row['Cmnts'] . "</td>"; echo "<td>" . $row['TStamp'] . "</td>"; echo "</tr>"; }
  24. Hi all Expert, I am PHP learner. I want to do something by PHP. My process is below:I have created a form now need to do like this: I will input data by PHP in my database.(I can input only one field data but i need to input multiple field data). Then database's all data will show in other page in & there will show a EDIT button then anyone can update their data by selecting name or ID. Then it will show me welcome page. This process I want to do.
  25. Hello internet I am pulling out my hair trying to figure this one out. Below is the only code I have in the php file. What I am trying to do is delete the only line of data in the database table and replace it with a new line of data. The data will delete but it will not do the insert function to put the new data in. I started out trying an UPDATE function but that did not work either. Separately each set of <?php ?> code works if I put them in separate files but together they do not work. Why? How can I achieve the desired effect? Please help. <?php$con = mysql_connect("xxx","xxx","xxx");mysql_select_db("xxx", $con);mysql_query("DELETE FROM ViewIt WHERE misc='1'");mysql_close($con)?> <?php$con = mysql_connect("xxx","xxx","xxx");mysql_select_db("xxx", $con);$sql="INSERT INTO ViewIt (misc, CC)VALUES ('1', '2')";mysql_close($con)?>
×
×
  • Create New...