[PHP] PHP or Bridge (card game)
To all PHP experts, Do any of you also know how to play bridge? If yes, which do you think is harder to learn, PHP or bridge? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] one click - two actions?
On Nov 13, 2006, at 9:44 PM, Paul Novitski wrote: Paul, Thank you again for your amazingly generous email. I am working on my query as you suggested. I have a joint query that seems to work except that I get the name of the company repeated for each job. Could you please help me figure out how to make it echo the company once and list all the jobs next to it on the same line and start a new line with the next company like you suggested bellow? Here is the code I have now: $query = SELECT client.companyName, job.jobType, job.pix, job.info, job.url FROM client, job WHERE client.companyId=job.companyId AND client.view='yes' order by client.companyName; $result = mysql_query($query) or die (Couldn't execute query); while ($aaa = mysql_fetch_array($result,MYSQL_ASSOC)) { echo span class='navCompany'{$aaa['companyName']}/spanspan class='navArrow' /spanspan class='navText'a href='single_page_t10.php?art=.$aaa['pix'].'{$aaa['jobType']}/a/ spanbr\n; } I think what you're looking for is JOIN syntax for your queries: http://dev.mysql.com/doc/refman/4.1/en/join.html For example: SELECT * FROM client, job WHERE client.companyId=job.companyId AND (client.status='active' or client.status='old') order by client.companyName; (Note that when you extract fields from more than one table like this, you identify the table that each field belongs to, e.g. client.companyId.) Then you can extract the desired fields from both tables in the same loop because they've been captured together. Your current logic executes a job query for every row of client, which is extremely inefficient. The dataset produced by the join query is going to look something like this: client. job. companyId companyId 1 2 1 3 1 9 2 4 2 5 ... In other words, there will be one row for each job record, with the (parent) client fields duplicated each row. You can further improve the efficiency of your query by naming only the fields you need, instead of using * to extract all fields: SELECT client.companyName, job.pix, job.jobType, job.url, job.web FROM client, job WHERE client.companyId=job.companyId AND (client.status='active' or client.status='old') order by client.companyName; Once you execute the join query, your PHP loop can cycle in a similar way, echoing a company name and then listing all the job types until a new company name occurs, etc. You've got other problems, however. If you look at your HTML source, you'll see markup like this: span class='navCompany'Builtworks/spanspan class='navArrow' /span span class='navText'a href='single_page.php? art=btw_logo.jpg'logo/a/span span class='navText'a href='single_page.php?art='/a/span span class='navText'a href='single_page.php?art='/a/span span class='navText'a href='single_page.php?art='/a/span span class='navText'a href='single_page.php?art='/a/span brspan class='navCompany'Citizens Bank / eProperty/spanspan class='navArrow' /span span class='navText'a href='single_page.php? art=ctz_web1.jpg'website/a/span All those empty hyperlinks aren't doing anything but making your download heavier than it has to be. I think you need to test your 'jobType' fields and output only those that aren't blank. Good luck, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variable gets lost on FORM action
On Jan 18, 2007, at 12:59 AM, Nuno Vaz Oliveira wrote: Roman: [...] You don't need to know your IP. See the grammar for AbsoluteURI: ftp://ftp.rfc-editor.org/in-notes/rfc2396.txt I'm asking this because my IP is dynamic and I'm using a free redirection service. My site is at 'http://something.no-ip.org/sitename' can I use 'http://something.no-ip.org/sitename/index.php?vaz=value' on the Locarion header? Actually you *must* use it instead of just the index... part. Thank you Roman, I'm now working with absolute paths! :) I Never thought that HTML had those specs... With the relative link it worked and so it was OK for me... Bye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie - help with a foreach
Could someone please help me figure out how to hide the info in the right bottom part of my page unless the corresponding link is selected in the top left. The company names and job types at the top left need to show at all time. But the corresponding picture at the bottom left and the web address/info at the bottom right should appear only when selected. I have the same query repeating twice once for the top left part and once for the bottom right part because I can't figure out how else to do it! Thank you. http://www.squareinch.net/single_page_t2.php?art=btw_logo.jpg
Re: [PHP] Newbie - help with a foreach
Thank you for your reply. My problem is that the web addresses on the bottom right show at all times as is instead of appearing only when active or selected on the left top navigation! Does that make sense? On Jan 18, 2007, at 1:43 AM, Németh Zoltán wrote: I can't really understand what your problem is, because it seems to me that the site is working like you want it to work. Or not? And if there is a problem with the code then please show us the code somehow, not the resulting webpage greets Zoltán Németh On cs, 2007-01-18 at 01:31 -0800, pub wrote: Could someone please help me figure out how to hide the info in the right bottom part of my page unless the corresponding link is selected in the top left. The company names and job types at the top left need to show at all time. But the corresponding picture at the bottom left and the web address/info at the bottom right should appear only when selected. I have the same query repeating twice once for the top left part and once for the bottom right part because I can't figure out how else to do it! Thank you. http://www.squareinch.net/single_page_t2.php?art=btw_logo.jpg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie - help with a foreach
On Jan 18, 2007, at 2:00 AM, Németh Zoltán wrote: ok, but how could anyone help without seeing your code? greets Zoltán Németh Here is the code: Here is the entire page: !-- nav/box 1 starts here -- ?php include(../include/etc_inc.php); $connection = mysql_connect($host,$user,$password) or die (couldn't connect to server); // connect to database $db = mysql_select_db($database,$connection) or die (Couldn't select database); // query a from client $query = SELECT * FROM client where status='active' or status='old' order by companyName; $result = mysql_query($query) or die (Couldn't execute query); while ($aaa = mysql_fetch_array($result,MYSQL_ASSOC)) { echo span class='navCompany'{$aaa['companyName']}/spanspan class='navArrow' /span\n; // query b from job $query = SELECT * FROM job WHERE companyId='{$aaa['companyId']}'; $result2 = mysql_query($query) or die (Couldn't execute query b); foreach($aaa as $jobType) { $bbb = mysql_fetch_array($result2,MYSQL_ASSOC); echo span class='navText'a href='single_page_t2.php?art=.$bbb ['pix'].'{$bbb['jobType']}/a/span\n; } echo br; } ? !-- nav/box 1 ends here -- /div div class=navbox2img src=images/sq_logo_137.gif alt=Square Inch logo width=137 height=137/div div class=navbox3?php $image = $_GET['art']; ? img src=images/?php print ($image) ? alt=Portfolio Item border=0 width=285 height=285/div div class=navbox4 !-- info/box 4 starts here -- ?php /* query 1 from client */ $query = SELECT * FROM client where status='active' or status='old' order by companyName; $result = mysql_query($query) or die (Couldn't execute query); while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { /* query 2 from job */ $query = SELECT * FROM job WHERE companyId='{$row['companyId']}'; $result2 = mysql_query($query) or die (Couldn't execute query2); $url = mysql_query($result2); foreach($row as $url) { $row = mysql_fetch_array($result2,MYSQL_ASSOC); if (url={$row['url']}) echo span class='navText'a href='{$row['url']}'{$row['web']}/ a/span; } echo br; } ? !-- info/box 4 ends here -- On cs, 2007-01-18 at 01:54 -0800, pub wrote: Thank you for your reply. My problem is that the web addresses on the bottom right show at all times as is instead of appearing only when active or selected on the left top navigation! Does that make sense? On Jan 18, 2007, at 1:43 AM, Németh Zoltán wrote: I can't really understand what your problem is, because it seems to me that the site is working like you want it to work. Or not? And if there is a problem with the code then please show us the code somehow, not the resulting webpage greets Zoltán Németh On cs, 2007-01-18 at 01:31 -0800, pub wrote: Could someone please help me figure out how to hide the info in the right bottom part of my page unless the corresponding link is selected in the top left. The company names and job types at the top left need to show at all time. But the corresponding picture at the bottom left and the web address/info at the bottom right should appear only when selected. I have the same query repeating twice once for the top left part and once for the bottom right part because I can't figure out how else to do it! Thank you. http://www.squareinch.net/single_page_t2.php?art=btw_logo.jpg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need help with an if statement
Hello, I am really new to all this and I am really hoping I can get some help PLEASE... I am making a website with x-cart which uses PHP and Smarty templates. I need to make an if statement that puts a little arrow gif in front of the link that is clicked on! make any sense? In other words: item 1 (not selected) item 2 (not selected) item 3 (selected) item 4 (not selected) This is what I have now, but I don't know what to call my {if ?} {if ?}A href={?}FONT class=buttontextonlyIMG src={$ImagesDir}/arrow.gif width=9 height=7 border=0 align=abstop{$menu_content}/FONT/A {else} FONT class=VertMenuTitle{$menu_content}/FONT {/if}/TD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php