PHP - Moved: Graphing Tool For Php Mysql Network Data?
This topic has been moved to Other Libraries and Frameworks.
http://www.phpfreaks.com/forums/index.php?topic=345560.0 Similar TutorialsThis topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=327407.0 This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=318962.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=331047.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=347191.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=322237.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=305750.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=330652.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=347192.0 I just signed up for an affiliate network (commission junction) to help me drive traffic to my donation generation website for Charities. My Software uses CAKE PHP on an Apache Server with MySql. I had to put a pixel on the order confirmation page passing the Transaction ID and The Purchase Amount from the database. The Transactions are located in the transaction table but the code that was written is passing EVERY Transaction in the database every time something is purchased. The Columns for the transaction table are ID CREATED MODIFIED USERID CLASS TRANSACTION_TYPE_ID and AMOUNT I have 32 types of Transactions in my Transaction_Type Table, the only transaction_types that are sales generated by the affiliate network are transaction_type 2. The code I have now which isn't working correctly is. <?php // Make a MySQL Connection mysql_connect("localhost", "frankgth", "andrew2011!") or die(mysql_error()); mysql_select_db("frankgth_groupon5") or die(mysql_error()); // Get all the data from the "example" table $result = mysql_query("SELECT * FROM `transactions` ") or die(mysql_error()); // keeps getting the next row until there are no more to get - while($row = mysql_fetch_array( $result )) { ?> <img src="https://www.emjcd.com/u?CID=1521593&OID=<?php echo $row['id'];?>&TYPE=349217&ITEM1=PURCHASE&AMT1=<?php echo $row['amount'];?>&QTY1=1&CURRENCY=USD&METHOD=IMG" height="1" width="20"> <?php } ?> How Do I only show this pixel if the action is Transaction_Type_ID is equal to number 2,with the Amount and Transaction ID. Thanks in advaced. This site helps charity so i really want to get it working! I'm attempting to implement a simple social networking system but at the moment am confused about how to create a multiple query which will display a certain user's friends list. The database contains four tables, the two tables that I'm using at the moment at 'usersTable' and 'friendshipsTable' are detailed below. usersTable | Table that stores all the user data UserID | Default primary key Forename | Surname | Username | Password | Email Address | friendshipTable | Table that stores information about friendships between users FriendshipID | Default primary key userID_1 | UserID userID_2 | UserID Status | Either Pending or Confirmed. The user's id is parsed into the url, and then saved into a variable. blah.com/userprofile.php?id=6 $id = $_GET['id']; I am familiar with creating simple queries, but can't quite work out how to set up multiple table queries. What the query needs to do is to check the userID that is parsed with the url, and then check the friendshipsTable by checking if either the userID_1 or userID_2 field matches the userID to grab the records from the table where there is a match. The next step is to check to see if the friendship is 'Confirmed' or 'Pending' and if it is 'Pending' to ignore it. Once the records have then been chosen I need the query to then check the value in either userID_1 or userID_2 that doesn't match userID and then pull the user's username and name from the usersTable so it can be displayed on a webpage. I've no idea hoe much I may or may not be overcomplicating this, an example of the code that I've got so far for this query can be found below, but that's as far as I've got at the moment. $displayFriends = mysql_query("SELECT * FROM friendshipTable, usersTable WHERE friendshipTable.userID_1='$id' OR friendshipTable.userID_2='$id' "); Cheers for any help. I am having problems being able to find the data that needs to be posted in various translation websites. I think this is because the translation tools they have are using some kind of flash script to translate? So the new page isn't being loaded using the post data string?? I am not completely sure, anyways... I am using live http headers on firefox to try and get the content for the post data string. The sites I have tried to get the post data from are these: http://www.freetranslation.com/ http://www.free-translator.com/ I can get cURL to visit the page and do everything, I just cant find the post data string. or maybe I am way off here.. Thanks for any help Hi, I am working on a project that involves mobile (android) and the application being designed connects to the database within PHPMYADMIN storing some table data entries. The language on the app being used is Flutter / DART and I do apologize, I am not familar at all with this language and my collegue has been writing his mobile code in this. I am the one who is going in and writing the PHP code that tells the data from the mobile app to be stored in a table. Hopefully this makes sense to you all still... Now... as shown below a diagram of how we have this app kicking and talking.
Thank for whom all can assist with this, but this is really the last piece of the puzzle then the app is finally done.
php output code: <!DOCTYPE html> <html> <head> <title>Test</title> <style> table { border-collapse: collapse; width: 100%; color: #588c7e; font-family: monospace; font-size: 25px; text-align: left; } th { background-color: #588c7e; color: white; } tr:nth-child(even) {background-color: #f2f2f2} </style> </head> <body> <table> <tr> <th>Id</th> <th>First Name</th> <th>Last Name</th> <th>Image</th> </tr> <?php $conn = mysqli_connect("localhost", "****", "****", "pmapp"); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT id, first_name, last_name FROM pmvisit"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "<tr><td>" . $row["id"]. "</td><td>" . $row["first_name"] . "</td><td>" . $row["last_name"]. "</td></tr>"; } echo "</table>"; } else { echo "0 results"; } $conn->close(); ?> </table> </body> </html> Edited February 16, 2020 by Barand obscuring pwd Ok, I have a graphing class that I built to build simple bar/line graphs for work. I have a side project I'm working on that is a little bigger in terms of data. Usually I do months or weeks. But I have some arrays with about 1000 data sets.
And when I create the image it stops at a certain point and doesn't even draw the X-Axis (One of the last procedures in my code).
And I know there is an issue, because if I Limit the query to 100 results, the graph will come out fine. If I limit it to 200 results the plotted line will show but the X-Axis will be cut of. If I put it to 300 results the plotted line will stop towards 2/3rds the way through the graph.
So I know the code is working when I reduce the results. I check the image info and it's only 3.25kb in size. Not sure what's going on here. I tried googling it but really didn't come up with any solid answers like most google searches.
If anyone has a clue why this is happening, please let me know.
Thanks a lot in advance.
And what's weird is if I add Zebra gridlines to it, on the colored zebra background, I can see a white line that represents the data. It's almost like the ink runs out, lol.
Edited by akphidelt2007, 26 June 2014 - 07:31 PM. Hello to all, I have problem figuring out how to properly display data fetched from MySQL database in a HTML table. In the below example I am using two while loops, where the second one is nested inside first one, that check two different expressions fetching data from tables found in a MySQL database. The second expression compares the two tables IDs and after their match it displays the email of the account holder in each column in the HTML table. The main problem is that the 'email' row is displayed properly while its while expression is not nested and alone(meaning the other data is omitted or commented out), but either nested or neighbored to the first while loop, it is displayed horizontally and the other data ('validity', 'valid_from', 'valid_to') is not displayed.'
Can someone help me on this, I guess the problem lies in the while loop? <thead> <tr> <th data-column-id="id" data-type="numeric">ID</th> <th data-column-id="email">Subscriber's Email</th> <th data-column-id="validity">Validity</th> <th data-column-id="valid_from">Valid From</th> <th data-column-id="valid_to">Valid To</th> </tr> </thead> Here is part of the PHP code:
<?php while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo ' <tr> <td>'.$row["id"].'</td> '; while ($row1 = $stmt1->fetch(PDO::FETCH_ASSOC)) { echo ' <td>'.$row1["email"].'</td> '; } if($row["validity"] == 1) { echo '<td>'.$row["validity"].' month</td>'; }else{ echo '<td>'.$row["validity"].' months</td>'; } echo ' <td>'.$row["valid_from"].'</td> <td>'.$row["valid_to"].'</td> </tr>'; } ?>
Thank you. This could be PHP or MySql so putting it in PHP forum for now... I have code below (last code listed) which processes a dynamically created Form which could have anywhere from 0 to 6 fields. So I clean all fields whether they were posted or not and then I update the mySQL table. The problem with this code below is that if, say, $cextra was not posted (i.e. it wasnt on the dynamically created form), then this code would enter a blank into the table for $cextra (i.e. if there was already a value in the table for $cextra, it gets overwritten, which is bad). What is the best way to handle this? I'm thinking i have to break my SQL query into a bunch of if/else statements like this... Code: [Select] $sql = "UPDATE cluesanswers SET "; if (isset($_POST['ctext'])){ echo "ctext='$ctext',"; } else { //do nothing } and so on 5 more times.... That seems horribly hackish/inefficient. Is there a better way? Code: [Select] if (isset($_POST['hidden']) && $_POST['hidden'] == "edit") { $cimage=trim(mysql_prep($_POST['cimage'])); $ctext=trim(mysql_prep($_POST['ctext'])); $cextra=trim(mysql_prep($_POST['cextra'])); $atext=trim(mysql_prep($_POST['atext'])); $aextra=trim(mysql_prep($_POST['aextra'])); $aimage=trim(mysql_prep($_POST['aimage'])); //update the answer edits $sql = "UPDATE cluesanswers SET ctext='$ctext', cextra='$cextra', cimage='$cimage', atext='$atext', aextra='$aextra', aimage='$aimage'"; $result = mysql_query($sql, $connection); if (!$result) { die("Database query failed: " . mysql_error()); } else { } hi guys, im new to this forum I'm new also to php, I need help from you guys: I want to display personal information from a certain person (the data is on the mysql database) using his name as a link: example: (index.php) names 1. Bill Gates 2. Mr. nice Guy i want to click Bill Gates (output.php) Name: Bill Gates Country:xxxx Age: xx etc. How can i make this or how to learn this? Hi I am trying to select and order data/numbers from a colum in a mysql data base however i run the code and it returns no value just a blank page no errors or any thing so i think the code is working right but then it returns no result? Please help thanks Here is the code: <?php $host= "XXXXXX"; $mysql_user = "XXXXXX"; $mysql_password = "XXXXXX"; $mysql_database = "XXXXXXX"; $connection = mysql_connect("$host","$mysql_user","$mysql_password") or die ("Unable to connect to MySQL server."); mysql_select_db($mysql_database) or die ("Unable to select requested database."); $row = mysql_fetch_assoc( mysql_query( "SELECT XP FROM Game ORDER BY number DESC LIMIT 1" ) ); $number = mysql_result(mysql_query("SELECT XP FROM Game ORDER BY number DESC LIMIT 1"), 0); echo "The the highest XP is $number"; ?> I have a form on our website that a user can fill out for custom product. I want the form data to be 1) stored into a mysql database AND after storing said data, 2) email the same data to our sales department. 1) The form data DOES get stored into mysql database (except for the first two fields, for some weird reason) 2) I added a "mail" section to the php file that stores the data into the database, but it is not working correctly. I have stripped the email portion down to sending just one of the fields in the "message" to make it easier for troubleshooting I have included here, both the form section of the html file, and the formdata.php file that processes the data for your analysis. I am relatively new to php so there are going to be some issues with security, but I can work on those after I get the store & email process to work correctly. Please review my code and see if anyone can be of assistance. I looked through the forums and couldn't find another issue that was the same as mine. If I just overlooked, please tell me the thread post #. Thanks THE FORM WHICH COLLECTS THE DATA ******************************* <form method=POST action=formdata.php> <table width="640" border=0 align="center"> <tr> <td align=right><b>First Name</b></td> <td><input type=text name=FName size=25></td> <td><div align="right"><b>Telephone</b></div></td> <td><input type=text name=Tel size=25></td> </tr> <tr> <td align=right><b>Last Name</b></td> <td><input type=text name=LName size=25></td> <td><div align="right"><b>Fax</b></div></td> <td><input type=text name=Fax size=25></td> </tr> <tr> <td align=right><b>Title</b></td> <td><input type=text name=Title size=25></td> <td><div align="right"><b>Email</b></div></td> <td><input type=text name=Email size=50></td> </tr> <tr> <td align=right><b>Company</b></td> <td><input type=text name=Comp size=25></td> <td> </td> <td> </td> </tr> <tr> <td align=right><b>Address</b></td> <td><input type=text name=Addr size=25></td> <td><div align="right"><b>Estimated Annual Volume</b></div></td> <td><input type=text name=EAV size=25></td> </tr> <tr> <td align=right><b>City</b></td> <td><input type=text name=City size=25></td> <td> </td> <td> </td> </tr> <tr> <td align=right><b>State/Province</b></td> <td><input type=text name=SProv size=25></td> <td><div align="right"><b>Application</b></div></td> <td><input type=text name=Appl size=25></td> </tr> <tr> <td align=right><b>Country</b></td> <td><input type=text name=Ctry size=25></td> <td><div align="right"><b>Type of System</b></div></td> <td><input type=text name=Syst size=25></td> </tr> <tr> <td align=right><b>Zip/Postal Code</b></td> <td><input type=text name=ZPC size=25></td> <td> </td> <td> </td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align=right> </td> <td><div align="right"><strong><font color="#FFFF00" face="Arial, Helvetica, sans-serif">COIL DESIGN</font></strong></div></td> <td><font color="#FFFF00" face="Arial, Helvetica, sans-serif"><strong>PARAMETERS</strong></font></td> <td> </td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align=right><b>Primary Resistance (ohms)</b></td> <td><input type=text name=Pres size=25></td> <td><div align="right"><b>Primary Inductance (mH)</b></div></td> <td><input type=text name=Pind size=25></td> </tr> <tr> <td align=right><b>Secondary Resistance (ohms)</b></td> <td><input type=text name=Sres size=25></td> <td><div align="right"><b>Secondary Inductance (H)</b></div></td> <td><input type=text name=Sind size=25></td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align=right><b>Peak Operating Current (Amps)</b></td> <td><input type=text name=POC size=25></td> <td> </td> <td> </td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align=right><b>Output Energy (mJ)</b></td> <td><input type=text name=Egy size=25></td> <td><div align="right"><b>Output Voltage (kV)</b></div></td> <td><input type=text name=Volt size=25></td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align=right><b># HV Towers per Coil</b></td> <td><input type=text name=TPC size=25></td> <td><div align="right"><b># of Coils per Package</b></div></td> <td><input type=text name=CPP size=25></td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <th colspan=4><b>Please enter any additional information he </b></th> </tr> <tr> <th colspan=4><textarea name=Mess cols=50 rows=10 id="Message"></textarea></th> </tr> </table> </dl> <div align="center"> <p> <input type=hidden name=BodyTag value="<body bgcolor="#484589" text="#FFFFFF" link="#FFFF00" alink="#FFFFFF" vlink="#FF7F00">"> <input type=hidden name=FA value=SendMail> </p> <p><font color="#FFFF00" face="Arial, Helvetica, sans-serif"><strong>PLEASE MAKE SURE ALL INFORMATION<br> IS CORRECT BEFORE SUBMITTING</strong></font></p> <p> <input type=submit value="Submit Form"> </p> </div> </form> THE FILE THAT PROCESSES THE FORM DATA (formdata.php) *********************************************** <?php $con = mysql_connect("localhost","XXX","XXX"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("customform", $con); $sql="INSERT INTO formdata (Fname, Lname, Title, Comp, Addr, City, SProv, Ctry, ZPC, Tel, Fax, Email, EAV, Appl, Syst, Pres, Pind, Sres, Sind, POC, Egy, Volt, TPC, CPP, Mess) VALUES ('$_POST[Fname]','$_POST[Lname]','$_POST[Title]','$_POST[Comp]','$_POST[Addr]','$_POST[City]','$_POST[SProv]','$_POST[Ctry]','$_POST[ZPC]','$_POST[Tel]','$_POST[Fax]','$_POST[Email]','$_POST[EAV]','$_POST[Appl]','$_POST[Syst]','$_POST[Pres]','$_POST[Pind]','$_POST[Sres]','$_POST[Sind]','$_POST[POC]','$_POST[Egy]','$_POST[Volt]','$_POST[TPC]','$_POST[CPP]','$_POST[Mess]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Your Information Was Successfully Posted"; mysql_close($con); $to = "recipient email address here"; $subject = "Custom Form"; $email = $_POST['Email'] ; $message = $_POST['Comp'] ; $headers = "From: $Email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=351748.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=314051.0 |