PHP/mySQL query syntax
Can I just check I have some of this right? It's fairly
basic, but just want to check I'm setting about it the right way,
as I'm new to the coding. (have in the past used Access a lot).
Basically I have tables for companies and contacts - in a one
to many relationship, as any given company may have many contacts -
which as far as I can tell is how you should do this rather than
have a single contacts table? (normalisation?)
So if the tables are :
Companies :
CompanyID (INT, auto increment)
Company
Address
etc
Contacts :
ContactID (INT, auto increment)
FirstName
LastName
etc
CompanyContacts :
CompanyID (INT)
ContactID (INT)
what should the SQL be for the page to display a company's
details along with each contact ?
I thought it might be something fairly simple like :
SELECT *
FROM Companies, CompanyContacts, Contacts
WHERE Company.CompanyID=CompanyContacts.CompanyID
But the Access flavour query comes out as :
SELECT *
FROM ([Companies] INNER JOIN [CompanyContacts] ON
[Companies].CompanyID = [CompanyContacts].CompanyID) INNER JOIN
[Contacts] ON [CompanyContacts].ContactID = [Contacts].ContactID;
If someone could translate the Access flavour query into
PHP/mySQL flavour that I could use as a reference that would be a
great help.
Cheers,
Iain
Thanks David.
Thinking about it, do I even need the interlinking table -
can I get away with :
Companies
CompanyID (primary key)
Company
etc
Contacts
ContactID (primary key)
CompanyID (foreign key)
FirstName
LastName
etc
And have
SELECT *
FROM Companies, Contacts
WHERE Companies.CompanyID = Contacts.CompanyID
Which would keep it relatively straightforward adding in new
companies and new contacts using DWs insert record behaviour, ie
wouldn't have the complication of populating the CompanyContacts
table?
Also - I've ordered your book from Amazon this week - so once
I get this project completed the plan is to work through it and
firm up some of the stuff I've been doing.
Iain
Similar Messages
-
PHP+MySQL query with empty value
Hi!
Software is DW8 with Apache 2.0.48, MySQL ver. 4.0.15a, PHP
4.2.3.
We had problem when a submitted value for 'regionID' in the
submit page
was left blank and the following error message appears in the
result page:
"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
'LIMIT 0,
3' at line 1"
The problem was solved by adding at the top of the page:
<?php
if (isset($_POST['regionID']) &&
empty($_POST['regionID'])) {
$_POST['regionID'] = '0';
?>
How to change the above code to retrieve ALL records when an
empty \
blank value is submitted for 'regionID'?
TIA
Nanubbgirl wrote:
> Something I picked up at a PHP/MySQL seminar...
$_REQUEST works in place of
> either $_GET or $_POST. It basically means use either
get or post. But it is
> less precise because it can pick up either variable and
has to think about the
> request...
I'm afraid you've picked up rather poor information.
$_REQUEST relies on
register_globals being turned on. Since register_globals is
considered a
major security risk, the default setting has been off since
April 2002.
Many hosting companies have turned register_globals on, in
spite of the
security problems, because so many poorly written scripts
rely on it.
The PHP development team has decided to resolve this security
issue once
and for all by removing register_globals from PHP 6.
Forget $_REQUEST. Use $_POST and $_GET always. It's safer,
and it's
futureproof.
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/ -
I'm trying to get a date field to display in the format 01
Jan 2007 rather than mySQLs default format.
My original query looks like :
<?php
mysql_select_db($database_connOriental, $connOriental);
$query_rsOrders = "SELECT * FROM Orders INNER JOIN Customers
WHERE OrderCustomerID = CustomerID ORDER BY OrderID ASC";
$rsOrders = mysql_query($query_rsOrders, $connOriental) or
die(mysql_error());
$row_rsOrders = mysql_fetch_assoc($rsOrders);
$totalRows_rsOrders =
mysql_num_rows($rsOrders);
?>
Which works fine, but with the mySQL default format.
So I added a separate query to convert it to the reformatted
version :
<?php
mysql_select_db($database_connOriental, $connOriental);
$query_DateFormat = "SELECT date_format(OrderDate, '%D %b
%Y') as formatted_date FROM Orders INNER JOIN Customers WHERE
OrderCustomerID = CustomerID";
$DateFormat = mysql_query($query_DateFormat, $connOriental)
or die(mysql_error());
$row_DateFormat = mysql_fetch_assoc($DateFormat);
$totalRows_DateFormat = mysql_num_rows($DateFormat);
?>
It works fine in that the format is correct, but it's only
showing the first date in the recordset for each order, rather than
the correct date for each order.
I'm not sure why, as other than the date format the query is
the same.
My best guess is that I need to reference the OrderID, but
I'm not sure of the correct syntax....?In the end it just needed the
, date_format(OrderDate, '%d %M %Y') as formatted_date
added into the original query and that's working fine.
I have another page however, where a customer logs in to an
account section, which does it slightly differently, ie they click
on 'View orders' link, which displays their orders based in
matching the customer ID of the customer currently logged in.
So I thought it would be a simple case of adding in the
date_format bit above, but that's giving an error.
It uses SPRINTF which I'm not quite sure is, and the whole
query looks like :
[code]<php
$colname_rsOrders = "1";
if (isset($_SESSION['CustomerID'])) {
$colname_rsOrders = (get_magic_quotes_gpc()) ?
$_SESSION['CustomerID'] : addslashes($_SESSION['CustomerID']);
mysql_select_db($database_connOriental, $connOriental);
$query_rsOrders = sprintf("SELECT * FROM Orders WHERE
OrderCustomerID = %s ORDER BY OrderID Asc", $colname_rsOrders);
$rsOrders = mysql_query($query_rsOrders, $connOriental) or
die(mysql_error());
$row_rsOrders = mysql_fetch_assoc($rsOrders);
$totalRows_rsOrders = mysql_num_rows($rsOrders);
?>[/code]
So i changed it to :
[code]<php
$colname_rsOrders = "1";
if (isset($_SESSION['CustomerID'])) {
$colname_rsOrders = (get_magic_quotes_gpc()) ?
$_SESSION['CustomerID'] : addslashes($_SESSION['CustomerID']);
mysql_select_db($database_connOriental, $connOriental);
$query_rsOrders = sprintf("SELECT *, date_format(OrderDate,
'%d %M %Y') as formatted_date FROM Orders WHERE OrderCustomerID =
%s ORDER BY OrderID Asc", $colname_rsOrders);
$rsOrders = mysql_query($query_rsOrders, $connOriental) or
die(mysql_error());
$row_rsOrders = mysql_fetch_assoc($rsOrders);
$totalRows_rsOrders = mysql_num_rows($rsOrders);
?>[/code]
As per the other one, and that's giving the error :
Warning: sprintf() [function.sprintf]: Too few arguments in
/home/qdiizyfg/public_html/orderhistory.php on line 52
Query was empty
It's never straightforward! -
UILoader won't display images from PHP/MYSQL query
I'm working on an online photo catalog, it works in straight PHP/HTML http://www.buckleyphotos.com/search/index.php but the photos are too easy to grab (Facebook and myspace are loaded with my photos). I know anything on screen can be grabbed, I just want to make it a little harder.
I've got a version of the ordering page with a SWF on it that will hopefully display the photos, http://www.buckleyphotos.com/searchtest/showpic.php?num=1&showpic=21_71909_6908.jpg&el=200 9-07-19+NEMX+Crow+Hill&riderno=21, but so far no luck.
Here's the PHP:
<?php
$page = $_GET['num'];
$el = urlencode($_GET["el"]);
$riderno = $_GET["riderno"];
$showPic = strtolower($_GET["showpic"]);
echo "$showPic";
?>
This is the Actionscript:
import fl.containers.UILoader;
var loader:UILoader = new UILoader();
loader.scaleContent = false;
loader.source = "showPic.php";
addChild(loader);
The SWF is in the same folder as the images.
Any help will be much appreciated.I'm stil woking on this one,
http://www.buckleyphotos.com/wsp5706/source/image/showpic.php?num=1&showpic=21_71909_6487. jpg&el=2009-07-19+NEMX+Crow+Hill&riderno=21
Here's the PHP code
<?php
$page = $_GET['num'];
$el = urlencode($_GET["el"]);
$riderno = $_GET["riderno"];
$showPic = strtolower($_GET["showpic"]);
echo "$showPic";
?>
You can see the file name of the photo above the light gray SWF, that's the result of the PHP query, echo "showPic"
This is the AS 3 code:
import fl.containers.UILoader;
var loader:UILoader = new UILoader();
loader.scaleContent = false;
loader.source = "showPic";
addChild(loader);
This is the HTML:
<param name="movie" value="http://www.buckleyphotos.com/wsp5706/source/image/Main2.swf">
<param name="quality" value="high">
<param name="wmode" value="opaque">
<param name="swfversion" value="6.0.65.0">
<param name="expressinstall" value="../Scripts/expressInstall.swf">
<param name="allowScriptAccess" value="always">
<param name="loader.source" value="$showPic"> -
Mysql query not getting all the results, works fine in php
Hi All,
I have a slightly big query which works fine in php getting 400 results but in java I get only 14 results when I traverse through resultset. Here is the query
(select t1.to_uri as inv_to_uri, t1.sip_to as inv_sip_to, t1.sip_callid as inv_callid, t1.time as inv_time, t1.fromtag as inv_fromtag, t1.sip_status as inv_status, t2.to_uri as bye_to_uri, t2.sip_to as bye_sip_to, t2.sip_callid as bye_callid, t2.time as bye_time, t2.fromtag as bye_fromtag, t2.totag as bye_totag, t2.from_uri as bye_from_uri, t2.sip_from as bye_sip_from, sec_to_time(unix_timestamp(t2.time)-unix_timestamp(t1.time)) as length, ifnull(t1.time, t2.time) as ttime , 'outgoing' as call_type from acc t1 left outer join acc t2 on t1.sip_callid=t2.sip_callid and ((t1.totag=t2.totag and t1.fromtag=t2.fromtag) or (t1.totag=t2.fromtag and t1.fromtag=t2.totag)) and t2.sip_method='BYE' where t1.sip_method='INVITE' and (t1.username='manoj' and t1.domain='mantragroup.com') and t1.caller_deleted != '1' ) union (select t1.to_uri as inv_to_uri, t1.sip_to as inv_sip_to, t1.sip_callid as inv_callid, t1.time as inv_time, t1.fromtag as inv_fromtag, t1.sip_status as inv_status, t2.to_uri as bye_to_uri, t2.sip_to as bye_sip_to, t2.sip_callid as bye_callid, t2.time as bye_time, t2.fromtag as bye_fromtag, t2.totag as bye_totag, t2.from_uri as bye_from_uri, t2.sip_from as bye_sip_from, sec_to_time(unix_timestamp(t2.time)-unix_timestamp(t1.time)) as length, ifnull(t1.time, t2.time) as ttime , 'outgoing' as call_type from acc t1 right outer join acc t2 on t1.sip_callid=t2.sip_callid and ((t1.totag=t2.totag and t1.fromtag=t2.fromtag) or (t1.totag=t2.fromtag and t1.fromtag=t2.totag)) and t1.sip_method='INVITE' where t2.sip_method='BYE' and isnull(t1.username) and (t2.username='manoj' and t2.domain='mantragroup.com') and t2.callee_deleted != '1' ) order by ttime DESC limit 100,50
Also this queru works fine on mysql console getting all 400 results. Please tell me what might be going wrong in Java.
Thanks for your help and time,
Manoj.How do you know you're doing the same query in PHP, MySQL, and the console?
What's the code that's executing this?
There's nothing intrinsically wrong with the query, although it's a bit messy - surely it could be simplified from that?
Please format queries before posting in future. Also, did you really mean to let us know your company name and the name of a user? Seems a bit indiscrete.
select
t1.to_uri as inv_to_uri,
t1.sip_to as inv_sip_to,
t1.sip_callid as inv_callid,
t1.time as inv_time,
t1.fromtag as inv_fromtag,
t1.sip_status as inv_status,
t2.to_uri as bye_to_uri,
t2.sip_to as bye_sip_to,
t2.sip_callid as bye_callid,
t2.time as bye_time,
t2.fromtag as bye_fromtag,
t2.totag as bye_totag,
t2.from_uri as bye_from_uri,
t2.sip_from as bye_sip_from,
sec_to_time(unix_timestamp(t2.time)-unix_timestamp(t1.time)) as length,
ifnull(t1.time, t2.time) as ttime ,
'outgoing' as call_type
from
acc t1
left outer join
acc t2
on
t1.sip_callid=t2.sip_callid
and
( (t1.totag=t2.totag and t1.fromtag=t2.fromtag)
or (t1.totag=t2.fromtag and t1.fromtag=t2.totag))
and
t2.sip_method='BYE'
where
t1.sip_method='INVITE'
and
(t1.username='manoj' and t1.domain='mantragroup.com') and t1.caller_deleted != '1'
union
select
t1.to_uri as inv_to_uri,
t1.sip_to as inv_sip_to,
t1.sip_callid as inv_callid,
t1.time as inv_time,
t1.fromtag as inv_fromtag,
t1.sip_status as inv_status,
t2.to_uri as bye_to_uri,
t2.sip_to as bye_sip_to,
t2.sip_callid as bye_callid,
t2.time as bye_time,
t2.fromtag as bye_fromtag,
t2.totag as bye_totag,
t2.from_uri as bye_from_uri,
t2.sip_from as bye_sip_from,
sec_to_time(unix_timestamp(t2.time)-unix_timestamp(t1.time)) as length,
ifnull(t1.time, t2.time) as ttime ,
'outgoing' as call_type
from
acc t1
right outer join
acc t2
on
t1.sip_callid=t2.sip_callid
and
( (t1.totag=t2.totag and t1.fromtag=t2.fromtag)
or (t1.totag=t2.fromtag and t1.fromtag=t2.totag))
and
t1.sip_method='INVITE'
where
t2.sip_method='BYE'
and
isnull(t1.username)
and
(t2.username='manoj' and t2.domain='mantragroup.com')
and
t2.callee_deleted != '1'
order by ttime DESC limit 100,50 -
MySQL InnerJoin query syntax error?
I can't seem to locate the syntax error in this MySQL query. Coldfusion says there an error in my sql syntax. Here is the query. Anyone have any clues on this?
<cfquery name="queryItem" datasource="bonus">
select
p.productid,
p.modelnumber,
p.modeldescription,
sp.sp_bonusamount as Amount
from
products i join bonusproducts sp on i productid = sp.sp_productid
inner join program p on sp.sp_programid = p.programid
where
p.CompanyOrgLevelID in (#getParentCompanyOrgLevelIDList(session.CompanyOrgLevelID)#)
and p.ProgramID = #programID#
<cfif categoryID gt 0>
and CategoryID in (#getSubcategoryIDList(categoryID)#)
</cfif>
order by
#sortColumn# #sortDirection#
</cfquery>To troubleshoot, run this:
select
p.productid,
p.modelnumber,
p.modeldescription,
sp.sp_bonusamount as Amount
from
products i join bonusproducts sp on i productid = sp.sp_productid
inner join program p on sp.sp_programid = p.programid
where 1 = 2
If it runs successfully, keep adding bits and pieces until it crashes. Then you'll know what made it crash.
Also enable debugging so you can see the sql that gets generated from your code. That's often useful. -
Correct syntax to write this mysql query?
Hello,
Need some help writing a mysql query that I lack the knowledge to do.
I have 2 tables, say table1 and table2. I want to take data from column (state) in table 1 and replace what is in column (state_id) in table 2.
notes:
The column names dont match.
I can match up the unique user ids from table1 to table2, they are the same.
I only want to replace data in a few columns, not the entire table, the other data must remain unchanged.
I want to tfer the data in the tables themselves from one to the other, not just compiled as a mysql query result.
Wasnt sure if i should use a merge? tried a few ways but with no luck.
anyone care to write something up i can use? im sure its easy to write, i just cant write advanced queries off the top of my head like that :-)quote:bregent: "Or did you edit the error message?" well i tried both with the table1 and without, then copied over the wrong error msg, since phpmyadmin doesnt like control + C. haha, good eye!
ok i used this query from the site:
UPDATE mIntent_profile, bought_adult
SET mIntent_profile.state_id = bought_adult.state,
mIntent_profile.city_id = bought_adult.city
WHERE mIntent_profile.profile_id = bought_adult.id
and it updated the state_id but for some reason it put all 0's in the city_id. COuldnt figure it out for a few minutes, then it dawned on me to check the type of data that could be entered into the city_id column... it was INT. changed it to VARCHAR and then it works.
thanks a lot for the push in the right direction, now the search on my clients site works much better. -
After a rather big upgrade yesterday (see paste below) I have got a problem with MySQL query browser which is found in package mysql-gui-tools. Everything else seems to be okay, but after upgrading mysql-gui-tools from 5.0r12-3 to 5.0r14-1 (..and now, after another update, its at 5.0r14-2) it is no longer able to refresh schema/databases. Every time I try to change/refresh schema in the schema menu to the right the program hangs and I have to kill it. A refresh icon appears as normal to the left of the schema I'm trying to refresh, but that icon too has frozen. I am however able to execute normal SELECT queries etc if I write the full "path" to the table in the SQL query, but when I try a USE query the same thing happens.
I have done some searching on the Internet about this and found this thread to be interesting. Too bad it's from July 2007..
I tried to downgrade to the old version of query browser, but then I got this problem:
/usr/bin/mysql-query-browser-bin: error while loading shared libraries: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory
..So I guess theres a dependency problem here with the old version.
Has anyone else got any problem with the MySQL Query Browser after upgrade or has any ideas for a solution?
Log from pacman:
[2009-04-12 13:52] synchronizing package lists
[2009-04-12 13:52] starting full system upgrade
[2009-04-12 13:55] upgraded xf86-input-evdev (2.1.2-1 -> 2.2.1-1)
[2009-04-12 13:55] upgraded xorg-server (1.5.3-5 -> 1.6.0-3)
[2009-04-12 13:56] synchronizing package lists
[2009-04-12 13:56] starting full system upgrade
[2009-04-12 13:56] upgraded glib2 (2.20.0-1 -> 2.20.1-1)
[2009-04-12 13:56] upgraded libcap (1.10-2 -> 2.16-3)
[2009-04-12 13:56] upgraded avahi (0.6.24-1 -> 0.6.24-3)
[2009-04-12 13:56] upgraded cdrkit (1.1.9-1 -> 1.1.9-2)
[2009-04-12 13:56]
[2009-04-12 13:56] >>> Deluge's daemon is running with the "deluge" user. The default download directory is /srv/deluge/
[2009-04-12 13:56]
[2009-04-12 13:56] upgraded deluge (1.1.5-1 -> 1.1.6-3)
[2009-04-12 13:56] upgraded jack-audio-connection-kit (0.109.2-2 -> 0.116.2-1)
[2009-04-12 13:56] upgraded gstreamer0.10-bad-plugins (0.10.11-2 -> 0.10.11-3)
[2009-04-12 13:56] upgraded hdparm (9.12-1 -> 9.14-1)
[2009-04-12 13:56] upgraded iptables (1.4.2-1 -> 1.4.3.1-1)
[2009-04-12 13:56] upgraded kbproto (1.0.3-1 -> 1.0.3-2)
[2009-04-12 13:57] upgraded kdelibs (4.2.2-3 -> 4.2.2-4)
[2009-04-12 13:57] upgraded kernel26-firmware (2.6.28-1 -> 2.6.29-1)
[2009-04-12 13:59] >>> Updating module dependencies. Please wait ...
[2009-04-12 13:59] >>> MKINITCPIO SETUP
[2009-04-12 13:59] >>> ----------------
[2009-04-12 13:59] >>> If you use LVM2, Encrypted root or software RAID,
[2009-04-12 13:59] >>> Ensure you enable support in /etc/mkinitcpio.conf .
[2009-04-12 13:59] >>> More information about mkinitcpio setup can be found here:
[2009-04-12 13:59] >>> http://wiki.archlinux.org/index.php/Mkinitcpio
[2009-04-12 13:59]
[2009-04-12 13:59] >>> Generating initial ramdisk, using mkinitcpio. Please wait...
[2009-04-12 13:59] ==> Building image "default"
[2009-04-12 13:59] ==> Running command: /sbin/mkinitcpio -k 2.6.29-ARCH -c /etc/mkinitcpio.conf -g /boot/kernel26.img
[2009-04-12 13:59] :: Begin dry run
[2009-04-12 13:59] :: Parsing hook [base]
[2009-04-12 13:59] :: Parsing hook [udev]
[2009-04-12 13:59] :: Parsing hook [autodetect]
[2009-04-12 13:59] :: Parsing hook [pata]
[2009-04-12 13:59] :: Parsing hook [scsi]
[2009-04-12 13:59] :: Parsing hook [sata]
[2009-04-12 13:59] :: Parsing hook [usbinput]
[2009-04-12 13:59] :: Parsing hook [keymap]
[2009-04-12 13:59] :: Parsing hook [filesystems]
[2009-04-12 13:59] :: Generating module dependencies
[2009-04-12 13:59] :: Generating image '/boot/kernel26.img'...SUCCESS
[2009-04-12 13:59] ==> SUCCESS
[2009-04-12 13:59] ==> Building image "fallback"
[2009-04-12 13:59] ==> Running command: /sbin/mkinitcpio -k 2.6.29-ARCH -c /etc/mkinitcpio.conf -g /boot/kernel26-fallback.img -S autodetect
[2009-04-12 13:59] :: Begin dry run
[2009-04-12 13:59] :: Parsing hook [base]
[2009-04-12 13:59] :: Parsing hook [udev]
[2009-04-12 13:59] :: Parsing hook [pata]
[2009-04-12 13:59] :: Parsing hook [scsi]
[2009-04-12 13:59] :: Parsing hook [sata]
[2009-04-12 13:59] :: Parsing hook [usbinput]
[2009-04-12 13:59] :: Parsing hook [keymap]
[2009-04-12 13:59] :: Parsing hook [filesystems]
[2009-04-12 13:59] :: Generating module dependencies
[2009-04-12 14:00] :: Generating image '/boot/kernel26-fallback.img'...SUCCESS
[2009-04-12 14:00] ==> SUCCESS
[2009-04-12 14:00] upgraded kernel26 (2.6.28.8-1 -> 2.6.29.1-3)
[2009-04-12 14:00] upgraded klibc-udev (140-1 -> 141-1)
[2009-04-12 14:00] upgraded libavc1394 (0.5.3-1 -> 0.5.3-2)
[2009-04-12 14:00] upgraded libcddb (1.3.0-3 -> 1.3.2-1)
[2009-04-12 14:00] upgraded libdatrie (0.1.2-1 -> 0.2.1-1)
[2009-04-12 14:00] upgraded libdrm (2.3.1-3 -> 2.4.9-1)
[2009-04-12 14:00] upgraded libdvdread (0.9.7-1 -> 0.9.7-2)
[2009-04-12 14:00] upgraded libfontenc (1.0.4-1 -> 1.0.4-2)
[2009-04-12 14:00] upgraded libid3tag (0.15.1b-2 -> 0.15.1b-3)
[2009-04-12 14:00] upgraded libmatroska (0.8.1-1 -> 0.8.1-2)
[2009-04-12 14:00] upgraded libmpd (0.16.1-1 -> 0.18.0-1)
[2009-04-12 14:00] upgraded libmysqlclient (5.0.77-1 -> 5.1.33-1)
[2009-04-12 14:00] upgraded libogg (1.1.3-1 -> 1.1.3-2)
[2009-04-12 14:00] upgraded libsamplerate (0.1.6-1 -> 0.1.7-1)
[2009-04-12 14:00] upgraded libthai (0.1.9-1 -> 0.1.11-1)
[2009-04-12 14:00] upgraded libx11 (1.2-1 -> 1.2.1-1)
[2009-04-12 14:00] installed libftdi (0.15-1)
[2009-04-12 14:00] upgraded lirc-utils (0.8.4-1 -> 0.8.5pre2-1)
[2009-04-12 14:00] upgraded m4 (1.4.12-1 -> 1.4.13-1)
[2009-04-12 14:00] upgraded man-db (2.5.4-2 -> 2.5.5-1)
[2009-04-12 14:00] upgraded man-pages (3.19-1 -> 3.20-1)
[2009-04-12 14:00] upgraded nvidia-utils (180.29-3 -> 180.44-1)
[2009-04-12 14:00] installed dri2proto (1.99.3-1)
[2009-04-12 14:01] upgraded mesa (7.2-1 -> 7.4-1)
[2009-04-12 14:01] upgraded mpfr (2.3.2-2 -> 2.4.1-1)
[2009-04-12 14:01] upgraded mpg123 (1.7.1-4 -> 1.7.2-1)
[2009-04-12 14:01] upgraded mysql-clients (5.0.77-1 -> 5.1.33-1)
[2009-04-12 14:01] upgraded mysql (5.0.77-3 -> 5.1.33-1)
[2009-04-12 14:01] upgraded mysql-gui-tools (5.0r12-3 -> 5.0r14-1)
[2009-04-12 14:01] In order to use the new nvidia module, exit Xserver and unload it manually.
[2009-04-12 14:01] upgraded nvidia (180.29-3 -> 180.44-1)
[2009-04-12 14:01] warning: /etc/pacman.d/mirrorlist installed as /etc/pacman.d/mirrorlist.pacnew
[2009-04-12 14:01] upgraded pacman-mirrorlist (20090108-1 -> 20090405-1)
[2009-04-12 14:01] upgraded pango (1.24.0-1 -> 1.24.0-2)
[2009-04-12 14:01] upgraded php (5.2.9-2 -> 5.2.9-3)
[2009-04-12 14:01] upgraded pm-utils (1.2.4-3 -> 1.2.5-1)
[2009-04-12 14:01] installed perl-xyne-common (0.01-5)
[2009-04-12 14:01] installed perl-html-tagset (3.20-1)
[2009-04-12 14:01] installed perl-html-parser (3.60-1)
[2009-04-12 14:01] installed perl-libwww (5.825-1)
[2009-04-12 14:01] installed perl-xyne-arch (0.03-5)
[2009-04-12 14:01] ######################
[2009-04-12 14:01] ## IMPORTANT NOTICE ##
[2009-04-12 14:01] ######################
[2009-04-12 14:01] Powerpill options and configuration file syntax have changed with
[2009-04-12 14:01] version 16.0. Please remove old configuration files and use the
[2009-04-12 14:01] default configuration file at /etc/powerpill.conf as a template for new
[2009-04-12 14:01] ones. Please see the man page for information on the command-line options.
[2009-04-12 14:01] upgraded powerpill (15.12-1 -> 16.0-5)
[2009-04-12 14:01] upgraded python-numpy (1.2.1-4 -> 1.3.0-1)
[2009-04-12 14:02] upgraded qt (4.5.0-3 -> 4.5.0-4)
[2009-04-12 14:02] upgraded qt3 (3.3.8-9 -> 3.3.8-10)
[2009-04-12 14:02] upgraded redland (1.0.8-1 -> 1.0.8-3)
[2009-04-12 14:02] upgraded tdb (3.3.1-1 -> 3.3.3-1)
[2009-04-12 14:02] upgraded smbclient (3.3.1-1 -> 3.3.3-1)
[2009-04-12 14:02] upgraded subversion (1.6.0-2 -> 1.6.1-2)
[2009-04-12 14:02] upgraded syslog-ng (3.0.1-4 -> 3.0.1-6)
[2009-04-12 14:02] upgraded tzdata (2009d-1 -> 2009e-1)
[2009-04-12 14:02] upgraded udev (140-2 -> 141-1)
[2009-04-12 14:02] upgraded xf86-input-keyboard (1.3.2-1 -> 1.3.2-2)
[2009-04-12 14:02] upgraded xf86-input-mouse (1.3.0-1 -> 1.4.0-2)
[2009-04-12 14:02] upgraded xf86-video-vesa (2.1.0-1 -> 2.2.0-1)
[2009-04-12 14:02] upgraded xfce4-mpc-plugin (0.3.3-2 -> 0.3.3-3)
[2009-04-12 14:02] upgraded xorg-server-utils (7.4-3 -> 7.4-4)
[2009-04-12 14:02] upgraded xorg-utils (7.4-2 -> 7.4-3)
Last edited by siaco (2009-04-14 21:42:10)I found the error on this. In the current PGKBUILD found in AUR, the patch mysql-gui-tools.chema_change_freeze_bug.patch is no longer applied.
I downloaded all related files to this package and built it myself now, with some changes to PGKBUILD and the mysql-gui-tools.chema_change_freeze_bug.patch. It works again :-)
New PGKBUILD:
# $Id: PKGBUILD,v 1.14 2009/04/12 11:52:45 dsa Exp $
# Maintainer: Douglas Soares de Andrade <[email protected]>
# Contributor: Vinay S Shastry <[email protected]>
pkgname=mysql-gui-tools
pkgver=5.0r14
pkgrel=2
arch=('i686' 'x86_64')
pkgdesc="Set of programs to manage and interact with a MySQL server."
url="http://www.mysql.com/products/tools/"
license=('GPL')
source=(http://mirrors.uol.com.br/pub/mysql/Downloads/MySQLGUITools/$pkgname-$pkgver.tar.gz
bad-char.patch
mysql-gui-tools-sigc_2.1.1_api_fixes.diff
mysql-gui-tools-5.0_p12-deprecated-gtk+-api.patch
mysql-gui-tools-gcc43.patch
mysql-gui-tools.chema_change_freeze_bug.patch)
depends=('gtkmm' 'gtkhtml' 'libmysqlclient' 'pcre')
replaces=('mysql-administrator' 'mysql-query-browser')
conflicts=('mysql-administrator' 'mysql-query-browser')
provides=('mysql-gui-common' 'mysql-administrator' 'mysql-query-browser')
makedepends=('pkgconfig' 'lua' 'libxml2' 'libgnomeprint')
options=('!makeflags')
build() {
cd $startdir/src/$pkgname-$pkgver
# Patch from mysql.com to fix the freeze when selecting a schema
patch -p1 < ../mysql-gui-tools.chema_change_freeze_bug.patch || return 1
# Patch to make 5.0r14 compile
patch -Np1 < $startdir/src/bad-char.patch
patch -Np1 < $startdir/src/mysql-gui-tools-sigc_2.1.1_api_fixes.diff
patch -Np1 < $startdir/src/mysql-gui-tools-gcc43.patch
patch -Np0 < $startdir/src/mysql-gui-tools-5.0_p12-deprecated-gtk+-api.patch
cd $startdir/src/$pkgname-$pkgver/common
sh autogen.sh
./configure --prefix=/usr --datarootdir=/usr/share --with-gtkhtml=libgtkhtml-3.14 || return 1
make || return 1
make DESTDIR=$startdir/pkg install || return 1
cd ..
cp -R common mysql-gui-common
cd $startdir/src/$pkgname-$pkgver/administrator
sh autogen.sh
./configure --prefix=/usr --datarootdir=/usr/share --with-gtkhtml=libgtkhtml-3.14 || return 1
make || return 1
make DESTDIR=$startdir/pkg install || return 1
cd $startdir/src/$pkgname-$pkgver/query-browser
sh autogen.sh
./configure --prefix=/usr --datarootdir=/usr/share --with-gtkhtml=libgtkhtml-3.14 || return 1
make CFLAGS="${CFLAGS} -D_GNU_SOURCE" || return 1
make DESTDIR=$startdir/pkg install || return 1
#cd $startdir/src/$pkgname-$pkgver/mysql-workbench
#patch -p1 < ../../mysql-gui-tools-5.0_p12-workbench-lua.patch
#./configure --prefix=/usr --with-gtkhtml=libgtkhtml-3.14 || return 1
#make || return 1
#make DESTDIR=$startdir/pkg install
# Some adjusts to make mysql-workbench run
#cd $startdir/pkg/usr/bin
#mv mysql-workbench mysql-wb
#mv mysql-workbench-bin mysql-wb-bin
#install -m755 $startdir/src/mysql-workbench.sh mysql-workbench
#rm -rf $startdir/pkg/usr/lib/
# Fixed startup scripts
install -m755 $startdir/mysql-administrator $pkgdir/usr/bin
install -m755 $startdir/mysql-query-browser $pkgdir/usr/bin
md5sums=('b8efefbf20b7264c8f3afd34424467d7'
'4279c75bb5e6c2bfcb16c98817d55b80'
'4625629385142862cd01d37f814d5e80'
'33205d45329ab4fa4096b6b298a60b2c'
'1368384dac87bc0a64adb774ab2e6cbd'
'2ff840932405f7a6a6863f633a639fe9')
New mysql-gui-tools.chema_change_freeze_bug.patch: (only changes to paths in file. Don't know if this was really needed, but I belive so.)
diff -ruN mysql-gui-tools-5.0r11.ORIG/query-browser/source/linux/MQQueryDispatcher.cc mysql-gui-tools-5.0r11/query-browser/source/linux/MQQueryDispatcher.cc
--- mysql-gui-tools-5.0r11.ORIG/query-browser/source/linux/MQQueryDispatcher.cc 2007-02-21 01:31:19.000000000 +0000
+++ mysql-gui-tools-5.0r11/query-browser/source/linux/MQQueryDispatcher.cc 2007-11-09 15:31:38.000000000 +0000
@@ -558,8 +558,8 @@
Gtk::Main::instance()->run();
- while(!req->is_complete())
+// while(!req->is_complete())
+// ;
return sps;
I hope this helps anyone else who needs to fix this! -
PHP/MySQL current detail item indicator
I'm building a site with CSS that uses PHP/MySQL for database
components. My "detail" page of a given set of items will have a
row of thumbnails at the bottom representing the entire query set.
I want to highlight the currently featured item within those
thumbnails so the user can identify where they are at.
I'm thinking I need to compare the ID key from the URL to the
ID key in the thumbnail set. If they match, the string would output
a different character embedded in a div ID so I could use CSS to
highlight the current item.
I think I'm on the right track but I'm a novice at PHP. How
would I code this?>if so can you advise me on the correct syntax to use as I'm not fluent in php.
I'm not a php developer so don't trust me on anything here.
>SELECT *
>FROM photos_tbl
>WHERE install_ID = ["installnumber"]
Here you are telling the where clause to look for an install_ID equal to the string "installnumber", which obviously is not correct. Is "installnumber" a variable you have created somewhere in the script? If so, then to create your SQL string you would use
"SELECT *
FROM photos_tbl
WHERE install_ID =" . $installnumber
Similar problem here
>SELECT *
>FROM photos_tbl
>WHERE install_ID = "rsDetail.install_UID"
You would not put variables inside of quotes. It would be something like
"SELECT *
FROM photos_tbl
WHERE install_ID = " . $rsDetail.install_UID -
Help with php mysql connect script
Ok guys im new to php mysql and i'm trying to insert some
form information in my database. Im using a script from sitepoint
in which i went through the tutorial did some experiments of my own
and it worked....
but now i'm getting this error which i cant figure out....
Error placing order: 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 'order SET product ='1',
size='medium', color='', quantity = '1' at line 1
here is the page
http://vaughntucker.com/imagecon/hats.php
and this is the script
<?php
//default page display
//connect to database
$dbcnx = @mysql_connect('p3nl41mysql7.secureserver.net',
'imagecon', 'Dub*boss_1');
if (!$dbcnx) {
echo '<p> Unable to connect to the '. 'database server
at this time.</p>';
exit();
//select database
if (!@mysql_select_db('imagecon')) {
exit('<p>Unable to locate the ' .
'database at this time.</p>');
//Mysql query add joke
if (isset($_POST['submit'])) {
$product = 1;
$size = $_POST['size'];
$color = $_POST['color'];
$quan = $_POST['quantity'];
$sql = "INSERT INTO order SET
product ='$product',
size='$size',
color='$color',
quantity = '$quan',
date = CURDATE()";
}else{
echo 'No data submited';
if (@mysql_query($sql)) {
echo '<p>Your order has been submited.</p>';
} else {
echo '<p>Error placing order: ' .
mysql_error() . '</p>';
?>
thanks in advance$sql = "INSERT INTO order SET
product ='" . $product . "',
size='" . $size . "',
color='" . $color . "',
quantity = '" . $quan . "',
I believe there are other more elegant ways to do this, as
well.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"beatzMalone" <[email protected]> wrote in
message
news:[email protected]...
> Ok guys im new to php mysql and i'm trying to insert
some form information
> in
> my database. Im using a script from sitepoint in which i
went through the
> tutorial did some experiments of my own and it
worked....
>
> but now i'm getting this error which i cant figure
out....
>
> Error placing order: 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
> 'order SET product ='1', size='medium', color='',
quantity = '1' at line 1
>
> here is the page
>
http://vaughntucker.com/imagecon/hats.php
>
> and this is the script
> <?php
> //default page display
> //connect to database
> $dbcnx = @mysql_connect('p3nl41mysql7.secureserver.net',
'imagecon',
> 'Dub*boss_1');
> if (!$dbcnx) {
> echo '<p> Unable to connect to the '. 'database
server at this
> time.</p>';
> exit();
>
> }
>
> //select database
> if (!@mysql_select_db('imagecon')) {
> exit('<p>Unable to locate the ' .
> 'database at this time.</p>');
> }
>
> //Mysql query add joke
> if (isset($_POST['submit'])) {
> $product = 1;
> $size = $_POST['size'];
> $color = $_POST['color'];
> $quan = $_POST['quantity'];
> $sql = "INSERT INTO order SET
> product ='$product',
> size='$size',
> color='$color',
> quantity = '$quan',
> date = CURDATE()";
> }else{
> echo 'No data submited';
>
> }
> if (@mysql_query($sql)) {
> echo '<p>Your order has been submited.</p>';
> } else {
> echo '<p>Error placing order: ' .
> mysql_error() . '</p>';
> }
>
>
>
> ?>
>
> thanks in advance
> -
I am using PHP/MySQL with Dreamweaver CS5, v.11. I want to query my table for a color entered by the user, and return results for words like "Brown" even if there are words before or after in the table cell. E.g., :
Silver Brown Yellow
Grey Blue Brown
Brown Blue Yellow
Here is a query I made in Dreamweaver that I thought would accomplish that:
if (isset($_GET['color'])) {
$color_items = $_GET['color']; }
$query_items = sprintf("SELECT * FROM Items WHERE Items.Color Like '%$color_items%'", GetSQLValueString($color_items, "text"));
$query_limit_items = sprintf("%s LIMIT %d, %d", $query_items, $startRow_items, $maxRows_items);
$items = mysql_query($query_limit_items, $CollectionLocal) or die(mysql_error());
$row_items = mysql_fetch_assoc($items);
Regardless of whether I use "$color_items", "%s", or an actual term like "brown," I am having problems.
If I use "Like '%$color_items%'" as in the example above, it returns a syntax error message indicating that it has changed what should be "%brown%" to "0row0". In other words, it's treating my text variable like an integer.
I tried putting making $color_items='%'.$_GET['Color'].'%', but that produces the same result.
If I zap the single quotes from the query, it assumes that $color_items is a column name, and because there's no column called $color_items, that produces an error.
If I don't use the GetSQLValueString formulation, and do something like this, it works:
$query_items = "SELECT * FROM Items WHERE Color Like '%$color_items%'";
$items = mysql_query($query_items, $CollectionLocal) or die(mysql_error());
$row_items = mysql_fetch_assoc($items);
$totalRows_items = mysql_num_rows($items);
And it works in MySQL alone, as well. I want to use the GetSQLValueStrinI apologize that the post ends so abruptly - an error occurred and I couldn't edit it any further.
I tried changing the variable type to "defined" and "long," and it didn't change my result.
Can anyone advise as to how I should be constructing my variable "color_items" so that it will work with the GetSQLValueString formulation? This query is just a snippet of a larger one with numerous variables all formatted using GetSQLValueString. I'd rather not have to change the whole query. Plus I don't know that much about escape strings, and I assume GetSQLValueString is Dreamweaver's way of helping to prevent a SQL injection attack.
Thank you!
Elizabeth -
Hello, i am new to php so be prepared for a idiots
question,Hello, Do i need to run this on my localhost or can i run
it on my virtual server as this allready has php mysql etc
installed.
i am new to php so be prepared for a idiots question, i have
been trying to copy a youtube tutorial to create a navbar using php
mysql and dreamweaver "
http://www.youtube.com/watch?v=habZHcnShfs"
to do this i need to create a mysql tabel in dreamweaver, to do
this i have been useing the following code;
<!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>Untitled Document</title>
</head>
<body>
<?php
$user="james1892";
$password="14011991";
$database="naviagation";
mysql_connect("localhost",$user,$password);
@mysql_select_db($database) or die("unable to select
database");
$query = 'CREATE TABLE 'menu' (
'mid' TINYINT( 3 ) UNSIGNED NOT NULL AUTO_INCREMENT,
'name' varchar(20) NOT NULL
'link' varchar(100) NOT NULL,
PRIMARY KEY ( 'mid' )
mysql_query($query);
mysql_close();
?>
</body>
</html>
this then returns the following message "Parse error: syntax
error, unexpected T_STRING in
/var/www/vhosts/sickstudentgames.com/httpdocs/php attempt 1/first
database midnamelink.php on line 15"
i then gave up on thsi as i couldnt work out what was the
problem and started a new code to create a database using this code
<!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>Untitled Document</title>
</head>
<body>
<?php
$con = mysql_connect("localhost","com1892","14011991");
if (!$con)
die('Could not connect: ' . mysql_error());
}if (mysql_query("CREATE DATABASE my_db",$con))
echo "Database created";
else
echo "Error creating database: " . mysql_error();
}mysql_close($con);
?>
</body>
</html>
this then showed the folling message "Warning:
mysql_connect(): Access denied for user 'com1892'@'localhost'
(using password: YES) in
/var/www/vhosts/sickstudentgames.com/httpdocs/php attempt
1/tableattempt2.php on line 10
Could not connect: Access denied for user
'com1892'@'localhost' (using password: YES)"
i have been uploading these to my website server as this has
php and mysql installed could this be the problem do i need to run
it on the coputers localhost>?
any help greatly appriciated
thanks you
i have been trying to copy a youtube tutorial to create a
navbar using php mysql and dreamweaver "
http://www.youtube.com/watch?v=habZHcnShfs"
to do this i need to create a mysql tabel in dreamweaver, to do
this i have been useing the following code;
<!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>Untitled Document</title>
</head>
<body>
<?php
$user="james1892";
$password="14011991";
$database="naviagation";
mysql_connect("localhost",$user,$password);
@mysql_select_db($database) or die("unable to select
database");
$query = 'CREATE TABLE 'menu' (
'mid' TINYINT( 3 ) UNSIGNED NOT NULL AUTO_INCREMENT,
'name' varchar(20) NOT NULL
'link' varchar(100) NOT NULL,
PRIMARY KEY ( 'mid' )
mysql_query($query);
mysql_close();
?>
</body>
</html>
this then returns the following message "Parse error: syntax
error, unexpected T_STRING in
/var/www/vhosts/sickstudentgames.com/httpdocs/php attempt 1/first
database midnamelink.php on line 15"
i then gave up on thsi as i couldnt work out what was the
problem and started a new code to create a database using this code
<!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>Untitled Document</title>
</head>
<body>
<?php
$con = mysql_connect("localhost","com1892","14011991");
if (!$con)
die('Could not connect: ' . mysql_error());
}if (mysql_query("CREATE DATABASE my_db",$con))
echo "Database created";
else
echo "Error creating database: " . mysql_error();
}mysql_close($con);
?>
</body>
</html>
this then showed the folling message "Warning:
mysql_connect(): Access denied for user 'com1892'@'localhost'
(using password: YES) in
/var/www/vhosts/sickstudentgames.com/httpdocs/php attempt
1/tableattempt2.php on line 10
Could not connect: Access denied for user
'com1892'@'localhost' (using password: YES)"
any help greatly appriciated
thanks youjames1892 wrote:
> Hello, i am new to php so be prepared for a idiots
question,Hello, Do i need to
> run this on my localhost or can i run it on my virtual
server as this allready
> has php mysql etc installed.
You don't need a local testing environment, but it's highly
recommended
that you do. It's much more efficient and secure.
> i have been trying to
> copy a youtube tutorial to create a navbar using php
mysql and dreamweaver
> "
http://www.youtube.com/watch?v=habZHcnShfs"
I watched about four minutes of that "tutorial". It's totally
useless.
> $query = 'CREATE TABLE 'menu' (
> 'mid' TINYINT( 3 ) UNSIGNED NOT NULL AUTO_INCREMENT,
> 'name' varchar(20) NOT NULL
> 'link' varchar(100) NOT NULL,
> PRIMARY KEY ( 'mid' )
> )';
The reason that doesn't work is because the creator of the
"tutorial"
failed to explain the difference between quotation marks and
backticks.
What actually appears on screen is not what you have typed,
but this:
$query = 'CREATE TABLE `menu` (
`mid` TINYINT( 3 ) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL
`link` varchar(100) NOT NULL,
PRIMARY KEY ( `mid` )
Note the difference between ' and `. The second one is called
backtick,
and is located above the tab key on most keyboards. In this
case, you
don't need it. The following would be fine:
$query = 'CREATE TABLE menu (
mid TINYINT( 3 ) UNSIGNED NOT NULL AUTO_INCREMENT,
name varchar(20) NOT NULL
link varchar(100) NOT NULL,
PRIMARY KEY (mid)
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
Conversion of Mysql query in oracle acceptable query format
Hi
I have successfully converted my MySql database in oracle. Now the problem is how to execute already written hundreds of Mysql query on the oracle. There are many syntax variation in Mysql query format which is not acceptable for oracle.
For Example
Select case_id as 'this is alias' from cases
The above query can run on Mysql database but have problem while executing Oracle, because single quotes should be replaced with double quotes before executing it on oracle. There are also many other syntax conflicts.
I have tried to resolve the problem through SwisSQLAPI but problem still exist as SwisSQLAPI is not dealing with all syntax conflict. In my case (select if (expresion, true,false)) must be replace with decode (expression, value,true,false) function of oracle and this conversion is not supported by SwisSQLAPI.
Please help me in resolving this problem
ThanksThe problem with trying to port from one language (mysql SQL) to another (oracle SQL) is that there's generally no hard rules for a computer to follow, that it will get it 100% correct.
Look at babelfish when you translate a foreign language to English. The end result is readable (usually), but it's rarely completely correct.
The problem is when you feed something into Oracle SQL, it needs to be 100% correct.
All you can really do here is rewrite these queries. It shouldn't actually take as long as you think, because 50% of queries will generally need very minor changes you can do in a minute, and 25% won't need any changes at all. -
Can't connect PHP/MySQL 404 error
Wow, the learning curve is killing me. Yet another challenge. I'm using Dreamweaver CC and this tutorial http://www.adobe.com/devnet/dreamweaver/articles/setup_php.html
I'm at this step:
Open comments.php. You must have a PHP page open in the Document window to create a MySQL connection.
In the Databases panel (choose Window > Databases), click the Plus button on the panel and select MySQL Connection.The MySQL Connection dialog box appears.
Type connTest as the connection name.
For the MySQL Server, type localhost.If you are using the MAMP default ports on a Mac, use localhost:8889.
For the User Name, type phptestuser.
Type the password you chose for the phptestuser account in the Password field.
For the Database, type php_test.Note: You don't need to precede the underscore with a backslash here. It was inserted by phpMyAdmin in the previous section (see Figure 20) only because phpMyAdmin uses a query that permits wildcard characters.
Click Test.Dreamweaver attempts to connect to the database. If the connection fails, do the following:
Double-check the server name, user name, and password.
Check the settings for the folder Dreamweaver uses to process dynamic pages (see Specifying a Testing Server for Dreamweaver).
Verify that the web and MySQL servers are both running.
Temporarily disable any firewall or security program. If the connection works, you need to configure the security program to permit communication between Dreamweaver and MySQL.
Click OK. The new connection appears in the Databases panel.
Expand the connTest connection, and then expand the Tables branch. You'll see the comments table in the database, which you can expand to reveal the details of the table columns (see Figure 23).
As far as I can tell I have followed this tutorial to the letter.
As far as I can tell, XAMPP/php mySQL are all running fine, the files are in the correct place and everything should be working. However when I hit test I get a 404 error. (Same error when I hit the select button.)
The suggested problems on the 404 message are:
1. There is no testing server running on the server machine.
Pretty sure the testing server is running. Is there any way to test this, other than to note that xampp is definitely running right now and that I can log into phpMYadmin no problem?
2. The testing server specified for this site does not map to the http://localhost/php_test/_MMServerScripts/MMHTTPDB.php URL Verify that the URL Prefix maps to the root of the site.
Ummm...I'm pretty sure I put things where I was told to put them in the tutorial, but I'm lost at this point where I should verify what. A clue here? The files are where they are supposed to be, but maybe I entered something wrong? Except...I'm not sure what that could be or where to find it. Whatever IT is.
Everything in local files is looking good.
Thanks for your help!
PS: Extra points to anyone who figures out how to make copy/pasteable error messages! These buggers are the bane of my life!Bgupta, you rock!
I hope you have copied the "mysql.php" and "MMHTTPDB.php" files from "C:\Users\username\AppData\Roaming\Adobe\Dreamweaver CC\locale\Configuration\Connections\Scripts\PHP_MySQL\_mmDBScripts" to "C:\xampp\htdocs\phptest\_mmServerScripts"
This was EXACTLY the problem. I checked the tutorial and I couldn't even find where the tutorial said to do this. (If I missed it, let me know where in the tutorial it was, please.)
Fixed! -
Show if field is not empty - PHP/MySQL
Is there a way I can only show bits of a page if a recordset
has entries in a certain field, automatically hiding the area if
the field is empty. (PHP/MySQL)
To put it in real terms, I have loads of products listed in a
repeating table. If a product has a photo gallery related to it
there is a 1 entered in 'photos' field, it has a video attached
here is a 1 entered in 'videos field and likewise for reviews it
will have a 1 entered in the reviews field.
What I'd like to have is a photo, video and review icon/link
in the 'master table' which only appears in the repeated products
that have a 1 listed in that field and have them not appear at all
when there is a 0 in the field.
Can anyone help me figure it outADDT is certainly a great help, as it - among many other
features - will allow you define whatever page element as
"show/hide" based on a query result -- for this it´s using a
so-called "condition builder" which lets you do that without
coding.
However you can achieve the same result without needing to
resort to ADDT -- by using a basic "if" condition that´s
checking the respective table column for having the value "1"
stored, and if so, display the page segment
The following 3 examples should work when replacing the
sample "queryname" with the query name your page is actually using:
<?php if ($row_queryname['photos'] == '1') {?>
display photo icon here
<?php }?>
<?php if ($row_queryname['videos'] == '1') {?>
display video icon here
<?php }?>
<?php if ($row_queryname['reviews'] == '1') {?>
display videos icon here
<?php }?>
Maybe you are looking for
-
How to use multiple languages at the same time for spell checking?
I use two different languages all the time and words are mostly so different (English and Finnish) that I could have spell checking on for both languages at the same time. Now it seem to allow to select only one language at the time and I have to swi
-
Rollover 18 weeks starting from week number of current month
Hi, I have a requirement as described below. Table Name Time: Columns: Fiscal Year, Fiscal Month and Fiscal Week above table has join with sales table and it contain sales data on week basis. so least granularity of data at week level. we have a repo
-
How Do I Reduce (or Eliminate) the "White" Part of a Two-Colour Gradient?
I've spent some time of late attempting to conquer what I call the "Gradient Monster", by which I mean that the concept of gradients did not come across that easily to me. Fast-forward to this morning. I've created a simple two-colour gradient using
-
Instances In recovery are getting recovered only after restart of server.
Hi All, The issue I face is :There is a BPEL Process with a DB adapter which has to poll on a database. Now my DB adapter polls,but the instance in EM remains in Recovery State. From BPEL Service Engine even if I recover,they dont get recovered. But,
-
Typecasting problem from int to CustomObject Class
Hi Guys, I have run into one strange requirement where I want to convert my int values to my CustomObject class which doesn't work and throws a compiler error "1067: Implicit coercion of a value of type int to an unrelated type GenericObject" where G