PHP - List Mysql Results In An Array For Easy Call Back
Lets start out by saying I'm a nube to sql/php things so I am learning as I go. I try to read all that I can before I post, and only post when I cant figure it out on my own.
That being said. What I want to do in simplest terms is be able to assign a variable to each item in an sql table. So say I have an mysql table that has ID, username, fontcolor. I want to be able to pull those out so say.... while($row = mysql_fetch_array($users)) { $username[$i] = $row[username]; $fontcolor[$i] = $row[fontcolor]; } Then on the page I can just call to $username[1] type thing. I have tried mixing this several different ways with for and while and I keep getting errors on the page. I realize the code isn't showing everything but its just there to show you the idea of what I'm trying to do. I just want it to generate a list(array) that will make it easier for me to call back just the items I need on parts of the page with out having to have extra coding everywhere. Thanks in advance. Jim Similar TutorialsBeen using a function I found here a while back for listing categories and sub categories and it works perfect. Code: [Select] function listSubcats ($parent, $level=0){ global $abc; $sql = "SELECT id, title FROM Cat WHERE parent = $parent"; $res = mysqli_query($abc, $sql); while (list($id, $title) = $res->fetch_row()) { $indent = str_repeat('-', $level); echo "<OPTION value='$id'>$indent $title</OPTION>\n"; listSubcats ($id, $level+1); // list its subcats } } But this is the first time I need change the way the results are displayed. And that leads me to realizing I am a bit confused on how list really works. The mysql table has the typical ID, CatName, parent I need to have each Cat with all subcats related to it listed in its own div. But whatever I try I cannot get the placements of the opening and closing divs in the right spots. So can anyone tell if its even possible to do it with this function. I did work it out using multiple queries but then read on alot of forums that queries inside while statements is not good. Just looking for he best (Correct) way of geting the results laid out properly. like this Code: [Select] <div class="one-third column"> Cat1 </div> <div class="one-third column"> Cat 2 </div> <div class="one-third column"> Cat 3 - Subcat 1 - Subcat 2 -- Sub Subcat 1 </div> <div class="one-third column"> Cat 4 </div> Hope that makes sense... Thanks for any guidance. I have these two tables...
schedule (gameid, homeid, awayid, weekno, seasonno)
teams (teamid, location, nickname)
This mysql query below gets me schedule info for ALL 32 teams in an array...
$sql = "SELECT h.nickname AS home, a.nickname AS away, h.teamid AS homeid, a.teamid AS awayid, s.weekno FROM schedule s INNER JOIN teams h ON s.homeid = h.teamid LEFT JOIN teams a ON s.awayid = a.teamid WHERE s.seasonno =2014"; $schedule= mysqli_query($connection, $sql); if (!$schedule) { die("Database query failed: " . mysqli_error($connection)); } else { // Placeholder for data $data = array(); while($row = mysqli_fetch_assoc($schedule)) { if ($row['away'] == "") {$row['away']="BYE";} $data[$row['homeid']][$row['weekno']] = $row['away']; $data[$row['awayid']][$row['weekno']] = '@ '.$row['home']; } }However, I only want to get info for one specific team, which is stored in the $teamid variable. This should be very easy, right? I have tried multiple things, including this one below (where I added an AND statement of "AND (h.teamid=$teamid OR a.teamid=$teamid)"), but this one still outputs too much... $sql = "SELECT h.nickname AS home, a.nickname AS away, h.teamid AS homeid, a.teamid AS awayid, s.weekno FROM schedule s INNER JOIN teams h ON s.homeid = h.teamid LEFT JOIN teams a ON s.awayid = a.teamid WHERE s.seasonno =2014 AND (h.teamid=$teamid OR a.teamid=$teamid)"; $schedule= mysqli_query($connection, $sql); if (!$schedule) { die("Database query failed: " . mysqli_error($connection)); } else { // Placeholder for data $data = array(); while($row = mysqli_fetch_assoc($schedule)) { if ($row['away'] == "") {$row['away']="BYE";} $data[$row['homeid']][$row['weekno']] = $row['away']; $data[$row['awayid']][$row['weekno']] = '@ '.$row['home']; } }Below is the array that the above outputs. In a nutshell, all I want is that 1st array ([1]) which has, in this example, the Eagles full schedule. It's not giving me too much else and I guess I could live with it and just ignore the other stuff, but I'd rather be as efficient as possible and only get what I need... Array ( [1] => Array ( [1] => Jaguars [2] => @ Colts [3] => Redskins [4] => @ 49ers [5] => Rams [6] => Giants [7] => BYE [8] => @ Cardinals [9] => @ Texans [10] => Panthers [11] => @ Packers [12] => Titans [13] => @ Cowboys [14] => Seahawks [15] => Cowboys [16] => @ Redskins [17] => @ Giants ) [27] => Array ( [1] => @ Eagles ) [28] => Array ( [2] => Eagles ) [4] => Array ( [3] => @ Eagles [16] => Eagles ) [14] => Array ( [4] => Eagles ) [15] => Array ( [5] => @ Eagles ) [3] => Array ( [6] => @ Eagles [17] => Eagles ) [] => Array ( [7] => @ Eagles ) [16] => Array ( [8] => Eagles ) [25] => Array ( [9] => Eagles ) [11] => Array ( [10] => @ Eagles ) [7] => Array ( [11] => Eagles ) [26] => Array ( [12] => @ Eagles ) [2] => Array ( [13] => Eagles [15] => @ Eagles ) [13] => Array ( [14] => @ Eagles ) ) Hello, im new here, and i have little experience to php and mysql as i started for 2 weeks ago. I started out with some tutorials and feeling im getting the hang of it. Enough of me, lets get to the point: <?php $con = mysql_connect('localhost',$user,$pass)or die(mysql_error()); $selectdb = mysql_select_db($selectdb)or die(mysql_error()); $sql = "SELECT * From table"; $result = mysql_query($sql); $num = mysql_num_rows($result); $myarray = array($result); $i =0; while ($i < $num){ echo $myarray[$i]; $i++; } ?> Here i have written a dummyscript that does what the original script does, it tries to fetch the keys from the table and then trying to loop it and echo out the results. The output in the browser is this: Resource id #3 I know this probably is a simple fix but i cant seem to get it sorted out. Hope some of you could help me get this baby work, or maybe have another way of doing it more "simple". Thanks in advance! Dan-Levi Say I have a table called artists with these fields (artistid, rank).
Then say I have an array called $rankadjustments with a value for each artist (like 1, 7, 3,-3, 5, 9, etc).
I am doing a MYSQL query that gets the info from artists table and sorts according to the rank field like this...
$sql = "SELECT * FROM artists ORDER BY rank";Easy enough. But what if I would like to bring that data back sorted by (rank + rankadjustment). For example, if the artist ranked 1st had a rank of "1" from mysql, but had a rankadjustment of "5" from the rankadjustment array, his "true" rank would be "6". Again, rankadjustment is NOT a field in my table, otherwise it would obviously be simple. It's calculated on the fly and stored in an array. FYI, the array has an index with their "artistid". For example, $rankadjustment[341][8] would be the artist with an artistid of "341" has a rank adjustment of 8. Is there a way to do this IN the query itself? It doesn't seem possible but wanted to find out for sure. If not, what is best way to do? I assume... Get the data sorted JUST by rank and put it all into an array, then create a new array that adds rank to rankadjustment and reorder by the "new" rank amount? I guess that wouldn't be too bad but again, wanted to make sure I'm not missing something that would allow me to do it all in the query (or just more efficiently). Thanks! Edited by galvin, 21 December 2014 - 09:13 PM. Hi All I am wanting to start writing neater coding so am wanting to refer to coding in a functions file. So for example, If i was getting info from database using the following code Code: [Select] $queryone = "SELECT * from affiliate where size='300x250' ORDER BY RAND() LIMIT 1"; $result = mysql_query($queryone); while ($row = mysql_fetch_assoc($result)) { echo "".$row['code'].""; } I would want this to go in a file called functions.php Then in my index.php(for example) I would want to link up to this code. Can anyone point me in the right direction please? Thanks! I need to update fields through a form, but there are MANY fields. Instead of UPDATE table SET email='$email', name, etc, for EVERY value, is there a shortcut that might loop through all my fields, since I want every one of them to be checked for updated info. I don't even know how to explain what I want to do as a subject. >.< Okay, so what I want to do is pull up all the entries in a table, (in this case "horse") for a specific location. Then, I want to pull all the results for that horse from the "result" table. Next, I want to compare each result from that table to a list of if/elseif for points. Finally, I want all the points gathered and totaled and displayed for that horse, and every other horse at that location, in a single page. Here is the coding that I have: Code: [Select] <? ---- connection information is here but removed ----- echo "<table> <tr><td><b>Name</b></td> <td><b>Points</b></td> <td><b>Title</b></td></tr>"; //finds horses at specific location $query = "SELECT * FROM horse WHERE location='DESIRED_LOCATION' ORDER BY name"; $result = mysql_query($query) or die (mysql_error()); while ($row = mysql_fetch_array($result)) { $id = $row['id']; $name = $row['name']; //gathers results based upon the above two pieces of information //the include is shown below as it contains the point info include('includes/points.php'); $query92 = "SELECT * FROM results WHERE MAIN_KEY='$id' OR MAIN_KEY = '$name'"; $result92 = mysql_query($query92) or die (mysql_error()); while($row92 = mysql_fetch_array($result92)) { $place = $row92['place']; echo "<tr><td>$name</td> <td>$points</td> <td>$title</td></tr>"; } } echo "</table>"; ?> and this is the points.php file: Code: [Select] <? if($place === '1st') {$points += 50;} elseif($place === '2nd') {$points += 45;} elseif($place === '3rd') {$points += 40;} elseif($place === '4th') {$points += 35;} elseif($place === '5th') {$points += 30;} elseif($place === '6th') {$points += 25;} elseif($place === '7th') {$points += 20;} elseif($place === '8th') {$points += 15;} elseif($place === '9th') {$points += 10;} elseif($place === '10th') {$points += 10;} elseif($place === 'CH') {$points += 50;} elseif($place === 'RCH') {$points += 40;} elseif($place === 'TT') {$points += 30;} elseif($place === 'T5') {$points += 30;} if($points < 500) {$title = "No Title";} elseif ($points >= 500 && $points < 1000) {$title = "Champion";} elseif ($points >= 1000 && $points < 2500) {$title = "Grand Champion";} elseif ($points >= 2500 && $points < 5000) {$title = "State Champion";} elseif ($points >= 5000 && $points < 8000) {$title = "National Champion";} elseif ($points >= 8000 && $points < 10000) {$title = "World Champion";} elseif ($points >= 10000) {$title = "Hall of Fame";} ?> I'm just learning php and I've created a test shopping website. Everything is working well, but I need help with the following: This is my products table in the database: "CREATE TABLE products ( id int(11) NOT NULL auto_increment, product_name varchar(255) NOT NULL, price varchar(16) NOT NULL, details text NOT NULL, category varchar(16) NOT NULL, subcategory varchar(16) NOT NULL, date_added date NOT NULL, PRIMARY KEY (id), UNIQUE KEY product_name (product_name) ) "; I have 3 subcategories: Hats, Pants and Shirts. On my index page I have links to these three items. This is my products.php code. When run it shows all the items in the 3 subcategories. How do I change the code so that this page display only the Hats when someone clicks on the Hats link? <?php // Connect to the MySQL database include "storescripts/connect_to_mysql.php"; $dynamicList = ""; $sql = mysql_query("SELECT * FROM products ORDER BY subcategory DESC"); $productCount = mysql_num_rows($sql); // count the output amount if ($productCount > 0) { while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["product_name"]; $price = $row["price"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); $dynamicList .= '<table width="100%" border="0" cellspacing="0" cellpadding="6"> <tr> <td width="17%" valign="top"><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventory_images/' . $id . '.jpg" alt="' . $product_name . '" width="77" height="102" border="1" /></a></td> <td width="83%" valign="top">' . $product_name . '<br /> $' . $price . '<br /> <a href="product.php?id=' . $id . '">View Product Details</a></td> </tr> </table>'; } } else { $dynamicList = "We have no products listed in our store yet"; } mysql_close(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Store Home Page</title> <link rel="stylesheet" href="style/style.css" type="text/css" media="screen" /> </head> <body> <div align="center" id="mainWrapper"> <?php include_once("template_header.php");?> <div id="pageContent"> <table width="100%" border="0" cellspacing="0" cellpadding="10"> <tr> <td width="32%" valign="top"><h3>xxx</h3> <p>xxx</p></td> <td width="35%" valign="top"><h3>Latest Designer Fashions</h3> <p><?php echo $dynamicList; ?><br /> </p> <p><br /> </p></td> <td width="33%" valign="top"><h3>xxx</h3> <p>xxx</p></td> </tr> </table> </div> <?php include_once("template_footer.php");?> </div> </body> </html> If someone can help me I'd be so grateful! Hi, In my mysql database i have a text input option, in the registration form and edit my details form i have a multiple select dropdown list, which user selects options to populate the text input box, which ultimately populates the text field in the mysql database. All works perfectly. The dropdownlist consists of 3 parts <optgroups> first is current selection (what is the usesr current selection)works fine, The second <optgroup> is existing words, what words we(the site) have given as options, and the third <optgroup> is the words that others have used. This is where im having a small problem. Because its a text field when i call the data from the database, it calls the entire text box as a single option in my select list.. I want to break the words in the text field (at the comma) and have them listed each one as an option in the select list. Example what i need: Words in text box:(my input allows the "comma") word1, word2, word3, word4, word5, word6, How i want them called/displayed: <option value=\"word1\">word1</option> <option value=\"word2\">word2</option> <option value=\"word3\">word3</option> <option value=\"word4\">word4</option> <option value=\"word5\">word5</option> <option value=\"word6\">word6</option> here's my code: $query = "SELECT allwords FROM #__functions_experience WHERE profile_id = '".(int)$profileId."' LIMIT 1"; $original_functionsexperience =doSelectSql($query,1); $query = "SELECT allwords FROM #__functions_experience WHERE profile_id = '".(int)$profileId."' LIMIT 1"; $functionsexperiencelist=doSelectSql($query); $funcexpList ="<select multiple=\"multiple\" onchange=\"setFunctionsexperience(this.options)\">"; foreach ($functionsexperiencelist as $functionsexperienceal) { $selected=""; if ($functionsexperienceals->allwords == $original_functionsexperience) $selected=' selected="selected"'; $allwords=$functionsexperienceal->allwords; $funcexpList .= "<optgroup label=\"Current selection\"> <option value=\"".$allwords."\" ".$selected." >".$allwords."</option> </optgroup> <optgroup label=\"Existing Words\"> <option value=\"existing1,\">existing1</option> <option value=\"existing2,\">existing2</option> <option value=\"existing3,\">existing3</option> <option value=\"existing4,\">existing4</option> <option value=\"existing5,\">existing5</option> <option value=\"existing6,\">existing6</option> </optgroup> <optgroup label=\"Others added\"> //heres problem <option value=\"".$allwordsgeneral."\">".$allwordsgeneral."</option> </optgroup>"; } $funcexpList.="</select>"; $output['FUNCEXPLIST']=$funcexpList; The result im getting for optgroup others added: word1, word2, word3, word4, word5, how can i get it like this: <option value=\"word1\">word1</option> <option value=\"word2\">word2</option> <option value=\"word3\">word3</option> <option value=\"word4\">word4</option> <option value=\"word5\">word5</option> <option value=\"word6\">word6</option> Hi, I use the following code to create a select menu from an array of options stored in LISTS.php: include 'LISTS.php'; print('<select id="from" name="from">'); foreach ($langList as $lang) {printf('<option %s>%s</option>', ($from1 == $lang ? 'selected="selected"' : ''), $lang); } echo '</select>'; where LISTS.php includes the following: $langList = array(' ','English', 'French', 'German', 'Dutch', 'Spanish'); This works great, but now I want to do something similar with a checkbox list, where each checkbox has an associated 'onchange' javascript function and I'm getting pretty stuck. My checkbox list is of the following form: Code: [Select] <html> <ul style="height: 95px; overflow: auto; width: 200px; border: 1px solid #480091; list-style-type: none; margin: 0; padding: 0;"> <li id="li1b"><label for="chk1b"><input name="chk1b" id="chk1b" type="checkbox" onchange="function1('chk1b','li1b')">Option1</label></li> <li id="li2b"><label for="chk2b"><input name="chk2b" id="chk2b" type="checkbox" onchange="function1('chk2b','li2b')">Option2</label></li> //etc. </ul> </html> What I want to do is have 'Option1', 'Option2', etc. stored in an array in LISTS.php and have a PHP script that populates the checkbox list accordingly, in a similar manner to my select menu above. I can't work out how to get the ID of the next <li> and the next <input> in the list to go up by one each time, e.g. 'li1b' then 'li2b', 'li3b', etc. Could someone pls help me out? Thanks! Hello everyone, I have been trying several things,recently, and I can't figure out how to get a series of numbers, grouped together as a string of number, instead of it adding or grabbing the last number that was randomly generated. I'm wanting to save it in a variable (of course), so I can pass it though a query when it is needed. foreach($array as $number){ echo $number; } $array is the variable where it is an array but all the randomly generated numbers are stored there. All / any help would be gratefully appreciated. Hi, It's my first time here. I'm not a coder but I sometimes need to find solutions by myself so here I am... I think this one will be easy for all of you. I generate a PDF displaying data from fields on a DB They all display very well except the multiple choices. Here is an exerpt of my code; I tried the implode code to display my values separated by commas but in the document it stil displays "Array" (screenshot enclosed) instead of something like: "Sante mentale, Reussite scolaire, Environnement sain " And I obviously don't know what's wrong...
<tr><td><?php echo $fields['prenomact']['value']; ?> <?php echo $fields['nomact']['value']; ?></td><td><?php echo $fields['titreact']['value']; ?></td></tr> Thanks in advance for your help, Valérie
My Php Buddies, I have mysql tbl columns these:
id: Now, I want to display their row data by excluded a few columns. Want to exclude these columns: date_&_time account_activation_code account_activation_status id_verification_video_file_url password
So, the User's (eg. your's) homepage inside his account should display labels like these where labels match the column names but the underscores are removed and each words' first chars CAPITALISED:
Id: 1
For your convenience only PART 1 works. Need help on Part 2 My attempted code:
PART 1 <?php // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Query to get columns from table $query = $conn->query("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'members' AND TABLE_NAME = 'users'"); while($row = $query->fetch_assoc()){ $result[] = $row; } // Array of all column names $columnArr = array_column($result, 'COLUMN_NAME'); foreach ($columnArr as $value) { echo "<b>$value</b>: ";?><br><?php } ?> PART 2 <?php //Display User Account Details echo "<h3>User: <a href=\"user.php?user=$user\">$user</a> Details</h3>";?><br> <?php $excluded_columns = array("date_&_time","account_activation_code","account_activation_status","id_verification_video_file_url","password"); foreach ($excluded_columns as $value2) { echo "Excluded Column: <b>$value2</b><br>"; } foreach ($columnArr as $value) { if($value != "$value2") { $label = str_replace("_"," ","$value"); $label = ucwords("$label"); //echo "<b>$label</b>: "; echo "$_SESSION[$value]";?><br><?php echo "<b>$label</b>: "; echo "${$value}";?><br><?php } } ?> PROBLEM: Columns from the excluded list still get displayed. Edited November 19, 2018 by phpsaneOk so I have this site where I'm posting a message to my Database. But when I go to pull the message from the MYSQL DB it's one long sentence. Any suggestions? I'm trying to search the 'ad' column where 'ad' = 1 or 3 I'm having problems doing this. Here is what I currently have, but it is not bringing back 'ad' where ='1' (for obvious reasons) Quote $query = "SELECT * FROM users WHERE ad='3' AND state='$state1'"; Here is what I thought would work, but it displays every listing in my database when I do it this way. Quote $query = "SELECT * FROM users WHERE ad='3' OR ad='1' AND state='$state1'"; Thank you in advance for your answers, google is not being so kind to me right now. Hello, I'm a new building my career as a web developer/designer and i'm attempting to create an array that holds different attributes of all the web projects. Site1 => array('www.siteurl.com','hostAccountName','Offline domain name',) , Site2 => array('www.site2url.com','hostAccoun2tName','Offline domain2 name') , Site3 => array('www.site2url.com','hostAccount3Name','Offline domain3 name') , I have many sites in the multidimensional array BUT each has the same format of attributes. I store this entire array in one file that gets included, and based on some logic later , the script will decide which site i'm currently working on and thus that site's attributes must be used, since i will just use one variable where these attributes are needed and leave it upto some logic to decide which site's attributes to use. Objective of the code : To change the array keys of each site's attributes from 0,1,2 etc to more readable strings for later use to directly access values. I'm creating an array with the values first and then running some code to change the keys later because i might decide to change the key names later and i can't manually edit it for each of the array values because the array might grow much larger. Site1 => array ([0] => 'www.siteurl.com', [1] => 'username@hostserver', [2] => 'siteOfflineDomain'); must change into Site1 => array (['siteUrl] => 'www.siteurl.com', ['hostingUserName'] => 'username@hostserver', ['OfflineVirtualHost'] => 'siteOfflineDomain'); And this must happen in a foreach loop and go through all the sites to change all the default 0,1,2 indices, to the index names i provide. Code : $siteList = array ( 'site1' => array ( 'www.site1.com', 'site1@host', 'site1_offline' ), 'site2' => array ( 'www.site2.com', 'site2@host', 'site2_offline' ), 'site3' => array ( 'www.site3.com', 'site3@host', 'uttarkar_offline' ) ); foreach ($siteList as $sitePrefix => $siteAttributes) { foreach ($siteAttributes as $oldIndex => $attribute) { switch ($oldIndex) { case 0 : $siteAttributes['siteUrl'] = $siteAttributes[$oldIndex]; unset($siteAttributes[$oldIndex]); break; case 1 : $siteAttributes['hostserverUserName'] = $siteAttributes[$oldIndex]; unset($siteAttributes[$oldIndex]); break; case 2 : $siteAttributes['offlineDomainName'] = $siteAttributes[$oldIndex]; unset($siteAttributes[$oldIndex]); break; } } echo 'The newly edited attributes array for ',$sitePrefix,'is '.print_r($siteAttributes),'<br><br>'; } Problem : This script works great, and the indices for the attributes get changed as expected, as you will see in the echo statement. But if i do a echo $siteList['site1']['siteUrl'] after the code, it says 'unknown index siteUrl'. Then i check the entire array with print_r($siteList) , and all the index keys are back to being 0,1,2!. My guess is that theres something i'm missing here to make them stick, but i spent 3 hours trying to figure it out, and i was getting a bit impatient, so can i get some help on this one please , thanks. Hi am in processes of making a bespoke CMS for a project in uni am having a problem with my scrip basically i have three php files i have content which echos out the database tables i wish to edit with a link to an update_content page when u click on that it bring u too update_content.php which allows the user to modifier the content in the tables but when i hit update am getting a Parse error: syntax error, unexpected T_IF in line 4 of my update_ac file any help would be great cheers richie <?php require("includes/connection.php") // If form button has been pressed then do the following if(isset($_POST['update'])){ // Get id of post $id = $_GET['id']; $header = $_POST['header']; $content = $_POST['content']; // Update database table $query = "UPDATE pages SET header = '$header', content = '$content' WHERE id = '$id'"; $result = mysql_query($query); if ($result){ echo "Successfully edited entry"; } else { echo "There was error editing entry"; } } ?> Hi I have been given a task to create some SQL reports. One of the reports is to display all the customers who have purchased a certain product based on user selection and then have those results able to be extracted to a mailing list. So ive got the report done. Some drop down boxes allow a user to select a product and once submitted the results are then displayed. But i dont even know where to begin with extracting those results to a mailing list. Could someone help me please? What method should I use? and where do i begin? BTW im a rookie with PHP/Mysql ive just got my first job since leaving university and this is a task ive been given at work so any quick and helpful replies are greatly appreciated Thanks in advance. i have a dictionary - THIS IS obviously a python dictionary an this has approx 8 000 lines with records [/CODE] $ python printer.py {'url': 'http://www.site1_com' 'cname': 'butcher', 'name': 'cheng', 'email': 'mail1@hotmail.com'} {'url': 'http://www.site2_com' 'cname': 'dilbert', 'name': 'James', 'email': 'mail2@hotmail.com'} [code=auto:0]i have a mysql-db up and runing in my opensuse there i have created a db with the fields url cname name i use the import MySQLdb i studied this documentation he http://stackoverflow...abase-in-python but i think this goes a bit over my head. - well how can i get the data ( in other words the dictionary) into the database? love to hear from you greetings |