Jonathon
Members-
Posts
1064 -
Joined
-
Last visited
-
Days Won
55
Everything posted by Jonathon
-
hello wframe, $q = 'SELECT column_a, column_b FROM table'; $r = mysqli_query($dbc, $q); while (list($column_a, $column_ = mysqli_fetch_array($r, MYSQLI_NUM)) { // Do something with the listed variables } // End of while loop Is a way to assign mysql results and put them straight into a variable to use later on Hope that helps? Jonathon
-
Yes i'd agree, it would really be an interactive way to learn, which would appeal to many! I'm sure Amazon does provide a massive market for possible buyers. But, with the kind of figures you told me you were receiveing through your site each month, you've got a very keen audience here. But if I want a book/kindle(if I had one), i'd go Amazon and I suppose most others would too, I suspect many like me, have bought a book of yours and then looked at other books of yours they could buy to increase their knowledge. On the other hand, I'm sure you put a lot of money through Amazon, so maybe you could negotiate a better deal?!(Then write a book about "tackling Amazon" ) Perhaps I'm getting ahead of myself here but, (bear with me, because it ultimately means more work for you)! if you were to make an app for the JS book. Perhaps you could document your experiences and make that into another self-published book. I can only see the app market going up and up currently, and everyone wants to cash in on it. So at this time it could be quite the investment. But I imagine it would cost you a LOT of time (one would imagine).
-
Haha, "Good things come to those who wait"! So i'm told anyway. Format wise, thats a toughy! For me I love having a printed version, So I can scribble my notes down as I go through. But I would imagine the cost of that format would be a lot more than other formats. You can't really go wrong with a PDF i'd say, for both the consumer and the manurfacturer. Because everyones got a device that can utilise a PDF readily (Mac/PC/iPad..etc) and they can then print this if they wanted too. I havent used a kindle or ePub though i'm sure theyr'e both excellent products. But i'm unsure of the costs involved with any of these formats. I just imagine PDF would be the more universal platform. What are your thoughts? I'm sure the apps would go down very well indeed too!
-
Select ... Into In Mysql
Jonathon replied to shaneg's topic in MySQL: Visual QuickStart Guide (2nd Edition)
Happy to help (where I can) -
Select ... Into In Mysql
Jonathon replied to shaneg's topic in MySQL: Visual QuickStart Guide (2nd Edition)
Hi Shaneg, I'm still not 100% sure of what you want to achieve. But i get the general idea. To be honest unless you have a very complex script the difference in performance it will take to execute will be negligible. If you want to, see the end of this topic I started. Programming speeds -
This is my file for your reference and this works. also note the variable $canada in your script is miss-splet <!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 content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled 1</title> </head> <body> <?php // Create one array $mexico = array( 'YU' => 'Yucatan', 'BC' => 'Baja California', 'OA' => 'Oaxaca' ); // Create another array $us = array( 'MD' => 'Maryland', 'IL' => 'Illinois', 'PA' => 'Pensilvania', 'IA' => 'Iowa' ); // Create another array $canada = array( 'QC' => 'Quebec', 'AB' => 'Alberta', 'NT' => 'Northwest Territories', 'YT' => 'Yukon', 'PE' => 'Prince Edward Island' ); // Combine arrays $n_america = array( 'Mexico' => $mexico, 'Canada' => $canada, 'United States' => $us ); // Loop through the countries foreach ($n_america as $country => $list) { // Print heading echo "<h2>$country</h2><ul>"; // Print each state or province foreach ($list as $key => $value) { echo "<li>$key - $value</li>\n"; } // Close List echo '</ul>'; } // End of main foreach ?> </body> </html>
-
First Lines On Footer.Html
Jonathon replied to WDjoe's topic in Effortless E-Commerce with PHP and MySQL
<!-- this in html is a comment--> much like // this is a comment in php -
Select ... Into In Mysql
Jonathon replied to shaneg's topic in MySQL: Visual QuickStart Guide (2nd Edition)
Right, looking at the second query that is erroring. The code should start something more like this: $q1 = 'SELECT xacres01 FROM xacres WHERE user_id=.............. I don't know your table or globals so I cant comment if they are right. Then, run the query $r1 = mysqli_query($dbc, $q1); if (mysqli_num_rows($r) == 1) { // IF The result returned 1 array that is if you mean it to return just 1 array list($owned) = mysqli_fetch_array($r, MYSQLI_NUM) } else { echo 'error with num rows'; } This will return a variable called $owned that should have the `xacres01` column in it. From there use the $owned variable inside the next MySQL query ($q2). something like "SELECT `column` FROM `table` where owned='$owned'"; I haven't run this code from an editor, so just make sure i haven't omitted any ';' or other syntax. Jonathon -
Select ... Into In Mysql
Jonathon replied to shaneg's topic in MySQL: Visual QuickStart Guide (2nd Edition)
I'm currently in work and on my phone. But I shall look at this in more depth when I'm in. It seems to me that: 1 - rather than use * just select the column you need from each table. 2 - use mysql to return the array and list() the value from the column in xacres table. Basically you assign value from the DB straight a variable. 3 - do any validation you need to do I.e. You got a valid result from the query and run the second query, using the $var you got from using the list() function on the first query results. Although I am still a bit confused as to what your trying to achieve, is this what you want to happen? 1 - Select 1 `column` from `xacres` table save the result as a variable 2 - Then use this variable inside the next MySQL query to get obtain the desired result. Also do you expect the query to return 1 result if so then you don't need a LIMIT. If it's going to return more than 1 result then how do you know which result you actually need.