[php+mysql] recordsets inside recordset?
Hi all,
is there a way to use a recordset result inside the SELECT
statement of
another recordset?
Something similar to:
SELECT myotherrecordsetresult FROM mytable WHERE
myfield=mycondition ORDER
BY mysortfield ASC
The variable "myotherrecordsetresult" would be text similar
to this:
"myotherrecordsetresult"="mycolumn1, mycolumn2, mycolumn...n"
I'm searching a way to display only columns specified by
another recordset.
Is this possible in dreamweaver or only by hand?
Thanks in advance.
tony
Look into the subquery syntax:
http://dev.mysql.com/doc/refman/5.0/en/subqueries.html
It lets you do things like this:
SELECT * FROM t1 WHERE column1 = (SELECT column1 FROM t2);
Sonjay
On 9/11/08 3:42 AM, "sweetman" wrote:
> Hi all,
> is there a way to use a recordset result inside the
SELECT statement of
> another recordset?
>
> Something similar to:
>
> SELECT myotherrecordsetresult FROM mytable WHERE
myfield=mycondition ORDER
> BY mysortfield ASC
>
> ?
>
> The variable "myotherrecordsetresult" would be text
similar to this:
>
> "myotherrecordsetresult"="mycolumn1, mycolumn2,
mycolumn...n"
>
> I'm searching a way to display only columns specified by
another recordset.
>
> Is this possible in dreamweaver or only by hand?
>
> Thanks in advance.
>
> tony
Similar Messages
-
Forum - php/mysql - recordset
Current Recordset:
SELECT id, threadid, postersname, topic, message, dateposted,
threadstarter, mypicurl FROM forum WHERE threadstarter = '1' ORDER
BY id DESC
repeat region displays results. Since the where clause limits
to only those that started threads, there are no duplicate topics.
Now I want to add two things to the results:
1. display the number of replies to the topic (i.e. all the
records that match the same threadid as the above recordset in the
repeat region, but where threadstarter = '0' )
I would also like to display the last person to enter a reply
(i.e. threadid matches the threadid of the recordset repeat region
and is the last entry in database).
How can I do this. I want to minimize my calls / recordsets
to accomplish this.jsteinmann wrote:
> Current Recordset:
> SELECT id, threadid, postersname, topic, message,
dateposted, threadstarter,
> mypicurl FROM forum WHERE threadstarter = '1' ORDER BY
id DESC
>
> repeat region displays results. Since the where clause
limits to only those
> that started threads, there are no duplicate topics.
>
> Now I want to add two things to the results:
>
> 1. display the number of replies to the topic (i.e. all
the records that match
> the same threadid as the above recordset in the repeat
region, but where
> threadstarter = '0' )
>
> I would also like to display the last person to enter a
reply (i.e. threadid
> matches the threadid of the recordset repeat region and
is the last entry in
> database).
>
> How can I do this. I want to minimize my calls /
recordsets to accomplish
> this.
You want a sub-query in your SQL, you basically put another
select
statement in brackets followed by AS ColumnName where
ColumnName is the
new name of that column. Make sense? If not I will try to
explain a
little more.
Dooza
Posting Guidelines
http://www.adobe.com/support/forums/guidelines.html
How To Ask Smart Questions
http://www.catb.org/esr/faqs/smart-questions.html
How To Report A Bug To Adobe
http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform -
PHP & MySQL recordset question
Hello all,
I've been searching for a while, and I can't seem to find an
answer, so sorry if this has been asked a lot.
I've got 5 tables that have similar information (id,
firstname, lastname, topic, thread, and date).
What I'm trying to do is have one search box where the user
types in a keyword. Then it searches all 5 tables in both the topic
and thread collumns. Then it displays the results from all 5 tables
and orders them by date.
I'm using dreamweaver 8, PHP, and MySQL.
I've tried to use this format:
SELECT column1 column 2
FROM table1
WHERE thread OR topic LIKE %variable%
UNION
SELECT column 1 column2
FROM table 2
WHERE thread OR topic LIKE %variable%
ORDER by date DESC
but keep getting error messages.
Is this possible? If so, can anyone help me figure out how to
do this, or where I can find a good tutorial?
Thanks.Thanks for your reply.
Sorry, here is the entire SQL statement:
SELECT eventforum.FirstName, eventforum.LastName,
eventforum.topic, eventforum.Thread, eventforum.`Date`
FROM eventforum
WHERE Thread or topic LIKE %colname%
UNION
SELECT fundforum.FirstName, fundforum.LastName,
fundforum.topic, fundforum.Thread, fundforum.`Date`
FROM fundforum
WHERE Thread OR topic LIKE %colname%
UNION
SELECT generalforum.FirstName, generalforum.LastName,
generalforum.topic, generalforum.Thread, generalforum.`Date`
FROM generalforum
WHERE Thread OR topic LIKE %colname%
UNION
SELECT persupport.FirstName, persupport.LastName,
persupport.topic, persupport.Thread, persupport.`Date`
FROM persupport
WHERE Thread OR topic LIKE %colname%
UNION
SELECT prosupport.FirstName, prosupport.LastName,
prosupport.topic, prosupport.Thread, prosupport.`Date`
FROM prosupport
WHERE Thread OR topic LIKE %colname%
UNION
SELECT soldier.FirstName, soldier.LastName, soldier.topic,
soldier.Thread, soldier.`Date`
FROM soldier
WHERE Thread OR topic LIKE %colname%
ORDER BY 'Date' DESC
the variable colname is defined as:
Name: colname
Type: Text
Default Value: -1
Runtime value: $_POST['searchbox']
here is the error message that I get with this setup:
Missing type for variable:colname
If I remove the variable and the WHERE statements, I get this
error message:
MySQL Error #: 1271
Illegal mix of collations for operation 'UNION'
If I remove the variable, the WHERE staements, and the ORDER
BY statement, I get the following error message:
MySQL Error #: 1271
Illegal mix of collations for operation 'UNION' -
Php/mysql behavours broken
I don't know what is going on but my copy of DW8 is now
unable to define php/mysql recordsets. I have a feeling that this
may be caused by a rogue extension. Only thing is it may have
occured a while back so I don't know when it started.
The problem is:
When I open an existing page which has recordsets on it I get
the following error:
Javascript error while loading recordset.htm
Unable to open script file
...\serverbehavours\php_mysql\fieldtypes.js (error 2)
I checked and the file was somehow missing so I replaced it.
Now I am being told:
The recordset script does not define the findserverbehavours
function
And I can see that the recordset is no longer there.
When I try to creat a new recordset I get:
The recordset script does not define the applyserverbehavours
function
Can anyone help
Thanksbikeman01 wrote:
> After a bit of experimenting it seems that my problem is
caused by the DW 8.0.2 hotfix extension. Removing it put everything
right.
As long as you have installed Dreamweaver 8.0.2, you should
also enable
the hotfix extension. Your problems were almost certainly
caused by a
corrupted cache. Follow troubleshooting step 4 in the
following page:
http://www.adobe.com/go/tn_19105
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
(PHP/MySql) Create Recordset but no column
Thanks for reading this, I am new to PHP/MySql
I have created a website www.ritchiecraft.co.uk which uses
PHP/MySql with Dreamweaver 8. I have created recordsets on most
items pages and filtered data as neccessary. After the site was up
and running I was required to insert a new topic and when I went to
create a new page and insert the recordset no data was placed in
the columns area and the filter/sort options were greyed out. I
checked the existing pages and found that this was happening to all
pages with recordsets. The connection, table data was there.
The site still works fine but I cannot introduce new pages or
edit existing because of the recordset problem. I was advised
previously to delete the Dreamweaver cache file but this did not
help.
The site is hosted commercially and the database was created
with phpMyAdmin and dont seem to have any connection problems.
Thanks for your time and any suggestions are welcome.sweetman wrote:
> How can I set a query so that it sounds like this:
>
> SELECT $_GET['id'] FROM mytable ORDER BY myorder ASC?
You can't do it through the Recordset dialog box. The simple
way to do
it is to create this query in the Recordset dialog box:
SELECT * FROM myTable
ORDER BY myOrder ASC
Then go into Code view and locate the following line:
$query_recordsetName = "SELECT * FROM myTable ORDER BY
myOrder ASC";
Change it to this:
if (isset($_GET['id'])) {
$col = get_magic_quotes_gpc() ? stripslashes($_GET['id']) :
$_GET['id'];
$col = mysql_real_escape_string($_GET['id']);
else {
$col = '*';
$query_recordsetName = "SELECT $col FROM myTable ORDER BY
myOrder ASC";
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
Problems with recordset in PHP/MySQL setting
We use Dreamweaver CS5 for creating dynamic pages (PHP pages with MySQL database). We test the site locally on a Windows 7 operating system with EasyPHP as WAMP server.
We often have a problem in managing the record set.
The following problem occurs quite often:
We take a PHP page. We create a recordset. We use a dynamic table or a repeated region to show the results of the recordset. So far so good.
Then we want to change something to the recordset for example the filter. When editing the recordset, the advanced mode is shown, it is impossible to swith to the simple mode.
By deleting the recordset the problem is not solved. By deleting and afterwards rebuilding the recordset, syntax errors occur. It seems that the php code for building the recordset didn't dissapear.
The only solutions till now seems to completely restart with a new PHP page.
Anyone has a solution for this or anyone did experience the same problem ?
Thank you very much in advance.
IlseYou cannot switch to Simple mode in the Recordset dialog box if you have made any changes to the SQL in Advanced mode.
Opening the Recordset dialog box to edit the settings does occasionally result in the code being inserted again instead of being changed. This appears to be an intermittent bug, which I have experienced myself, and know that others have complained about it, too. As far as I know, there is no solution other than to watch carefully the code that Dreamweaver generates.
If you don't understand the code, you would be well advised to learn what it means and does. Relying on Dreamweaver to do everything for you severely limits what you can do with PHP/MySQL. Adobe regards the server behaviors as quick prototyping tools, rather than for developing production websites. -
Using LIMIT function in PHP/MySQL Dreamweaver RecordSet
I want to have a record set that skips the first record, and shows the next three. I've found several suggestions online to use the LIMIT function, but I keep getting "error in SQL syntax." What am I missing?
mysql_select_db($database_adventcms, $adventcms);
$query_rsSideNews = "SELECT * FROM tb_news LIMIT 1, 3 WHERE status = 'Live' ORDER BY `date` DESC";
$rsSideNews = mysql_query($query_rsSideNews, $adventcms) or die(mysql_error());
$row_rsSideNews = mysql_fetch_assoc($rsSideNews);
$totalRows_rsSideNews = mysql_num_rows($rsSideNews);And there we go. That's the reason I need to go through PHP/MySQL training rather than relying on google searches!
-
Spry accordion with php mysql as data
Hello
I`m trying to create a spry accordion where the Labels are pulled from a mysql database table and the Content of that label is pulled from data in the same database. I tried adding first the spry accordion and then created 1 recordset for the labels and a second recordset for the content , then I added a repeat region for the labels DIV and inside this div I added a repeat region for the content.
Unfortunatly when viewed in the browsers the accordion doesn`t work.
Can anyone look at the code and tell me where is the mistake.
Thanks
<?php require_once('Connections/log.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
mysql_select_db($database_log, $log);
$query_log_year = "SELECT DISTINCT Year(`23849`.acoff) AS yy FROM `23849` ORDER BY Year(`23849`.acoff)";
$log_year = mysql_query($query_log_year, $log) or die(mysql_error());
$row_log_year = mysql_fetch_assoc($log_year);
$totalRows_log_year = mysql_num_rows($log_year);mysql_select_db($database_log, $log);
$query_log_year = "SELECT DISTINCT Year(`23849`.acoff) AS yy FROM `23849` ORDER BY Year(`23849`.acoff)";
$log_year = mysql_query($query_log_year, $log) or die(mysql_error());
$row_log_year = mysql_fetch_assoc($log_year);
$totalRows_log_year = mysql_num_rows($log_year);
$mhour_log_mon = "0";
if (isset($row_log_year['yy'])) {
$mhour_log_mon = $row_log_year['yy'];
mysql_select_db($database_log, $log);
$query_log_mon = sprintf("SELECT DISTINCT DATE_FORMAT(`23849`.acoff, '%%M') AS mon , DATE_FORMAT(`23849`.acoff, '%%m') AS m , sum(`23849`.ablock) as toth FROM `23849` WHERE YEAR(`23849`.acoff) = %s GROUP BY m ORDER BY m ", GetSQLValueString($mhour_log_mon, "int"));
$log_mon = mysql_query($query_log_mon, $log) or die(mysql_error());
$row_log_mon = mysql_fetch_assoc($log_mon);
$totalRows_log_mon = mysql_num_rows($log_mon);
?>
<!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>testing ajax php mysql</title>
<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
<link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="Accordion1" class="Accordion" tabindex="0">
<div class="AccordionPanel">
<?php do { ?>
<div class="AccordionPanelTab"><?php echo $row_log_year['yy']; ?></div>
<?php } while ($row_log_year = mysql_fetch_assoc($log_year)); ?>
<div class="AccordionPanelContent">
<table width="100%" border="0" cellspacing="5" cellpadding="5">
<?php do { ?>
<tr>
<td><?php echo $row_log_mon['mon']; ?></td>
<td><?php echo $row_log_mon['toth']; ?></td>
</tr>
<?php } while ($row_log_mon = mysql_fetch_assoc($log_mon)); ?>
</table>
</div>
</div>
</div>
<script type="text/javascript">
<!--
var Accordion1 = new Spry.Widget.Accordion("Accordion1");
//-->
</script>
</body>
</html>
<?php
mysql_free_result($log_year);
mysql_free_result($log_mon);
?>You only have 1 "AccordianPanel" which contains a list of "AccordianPanelTab" elements, then a list of "AccordianPanelContent" elements.
You need to have a list of "AccordianPanel" elements, each containing a pair or "AccordianPanelTab" and "AccordianPanelContent" elements.
HTH,
Randy -
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 }?> -
May be someone can help me out with this problem.
I have setup a new site using PHP MySQL and Dreamweaver 8.02.
Dreamweaver connects to the database but after creating a
recordset the recordset cannot be used.
instead Dreamweaver returns:
HTTP Error Code 500 internal Server Error
Any help will be much appriciated.
JosHello,
I have also had the same error - namely that whilst I could connect via ftp, upload/download files, and view database tables, any attempt to view of modify recordsets resulted in error 500.
Having checked other potential causes (e.g. selection/non-selection use of passive FTP setting, enabling of php, etc.), on the back of posts here I contacted my host and asked if if could relate to mod security, as further investigation revealed that the issue only occurred on sites where mod security had not been disabled (I don't like to disable mod security for obvious reasons - and I'm told you can't do that site by site with apache2 anyway).
After a few false starts, the problem was resolved - with the following response from my host: "The false positives were being generated by "/_mmServerScripts/MMHTTPDB.php" and that is what we've worked around in the rules. As such, any domain on [servername] using that script in the same way shouldn't generate a false-positive moving forward."
So it seems the answer (assuming your on an apache server of course) may be to modify the rules to allow full access for MMHTTPDB.php.
I hope that is of help to some. -
DW8.02 + php + mysql recordet issue
Am absolutely new to PHP and MySql having been using ASP
& MSSql for a
long while.
I have the latest versions of PHP and MySql installed which
would both
appear to be working correctly.
When I go to create a recordset in the usual manner - if I
press test I
can see the correct data, when I click OK to finish I get a
series of
JavaScipt errors "while executing findSeverBehaviours in
recordset.htm"
(line 53??) etc etc cannot find TomLR-PHP-AdvRS.htm
DW puts the code in the page, but the Bindings window remains
empty.
I've cleared the winfilecache - anyone got any other
suggestions??
TIA!!
Buzby
There's nothing more dangerous than a resourceful idiottwindude wrote:
> Buzby
>
> I too am trying to convert some apps to mysql
>
> CAn you please post how you got this to work with DW8
>
> I am getting an error trying to setup the RS
> when i try to 'select database"
> i get this:
> Your PHP server doesn't have the MySQL module loaded or
you can't
> use the mysql_(p)connect functions.
>
> I am running php/mysql on my xp pro workstation....with
dw8 on it
>
> ??? loss......
Sounds like you haven't installed the mysql module.
I'm sure someone who knows much much more about it than me
will be
along in a moment.
However - possibly the easiest way to do it without getting
your hands
dirty is to delete and then reinstall PHP - make sure you do
the
detailed route and look out for the modules section and check
all the
MySql ones (sorry can't remember exactly what they were
called - I've
only done this twice - the first one I bodged up!) -
otherwise it's
trawl through your php.ini file and uncomment all the mysql
components
that you think you may need!
HTH
Buzby
There's nothing more dangerous than a resourceful idiot -
I've posted this before and didn't get the answer that I need, probably because I didn't post all of my codes. I am using PHP/MySql. I created a website that has several forms. When I process three of the forms, I get the error messages below:
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 'Condition, Length, Color, City, `State`, Email, Photo) VALUES ('29', '4', 'Used'' at line 1.
Below I am posting the codes. Hopefully, this time I posted everything that I should have so that I can get assistance.
FORM
<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="individual" class="individual" id="individual">
<table width="594" border="0" class="test">
<tr></tr>
<tr>
<td width="166" class="td">Posting Title</td>
<td colspan="3"><span id="sprytextfield1">
<label>
<input name="Posting Title" type="text" class="test" id="Posting Title" size="35" />
</label>
<span class="textfieldRequiredMsg">Required</span></span></td>
</tr>
<tr>
<td class="td">Price</td>
<td colspan="3"><span id="sprytextfield2">
<label>
<input name="price" type="text" class="test" id="price" size="35" />
</label>
<span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
</tr>
<tr>
<td class="td">Size(s)</td>
<td colspan="3"><label>
<select name="size" size="1" multiple="multiple" class="test" id="size">
<option>0</option>
<option>2</option>
<option>4</option>
<option>6</option>
<option>8</option>
<option>10</option>
<option>12</option>
<option>14</option>
<option>16</option>
<option>18</option>
<option>20</option>
<option>22</option>
<option>24</option>
<option>26</option>
</select>
</label></td>
</tr>
<tr>
<td class="td">Condition</td>
<td colspan="3"><label>
<select name="Condition" class="test" id="Condition">
<option>New</option>
<option>Used</option>
</select>
</label></td>
</tr>
<tr>
<td class="td">Length</td>
<td colspan="3"><label>
<select name="Length" class="test" id="Length">
<option>Long</option>
<option>Short</option>
<option>Mid-Length</option>
</select>
</label></td>
</tr>
<tr>
<td class="td">Color</td>
<td colspan="3" class="td"><span id="sprytextfield5">
<label>
<input name="Color" type="text" class="test" id="Color" size="35" />
</label>
<span class="textfieldRequiredMsg">Required</span></span></td>
</tr>
<tr>
<td class="td">City</td>
<td class="td"><span id="sprytextfield4">
<label>
<input name="City" type="text" class="test" id="City" size="35" />
</label>
<span class="textfieldRequiredMsg">Required</span></span></td>
<td class="td"> </td>
<td class="td"> </td>
</tr>
<tr>
<td class="td">State</td>
<td colspan="3"><label>
<select name="State" class="test" id="State">
<option>AL</option>
<option>AK</option>
<option>AZ</option>
<option>AR</option>
<option>CA</option>
<option>CO</option>
<option>CT</option>
<option>DE</option>
<option>DC</option>
<option>FL</option>
<option>GA</option>
<option>HI</option>
<option>ID</option>
<option>IL</option>
<option>IN</option>
<option>IA</option>
<option>KS</option>
<option>KY</option>
<option>LA</option>
<option>ME</option>
<option>MD</option>
<option>MA</option>
<option>MI</option>
<option>MN</option>
<option>MS</option>
<option>MO</option>
<option>MT</option>
<option>NE</option>
<option>NV</option>
<option>NH</option>
<option>NJ</option>
<option>NM</option>
<option>NY</option>
<option>NC</option>
<option>ND</option>
<option>OH</option>
<option>OK</option>
<option>OR</option>
<option>PA</option>
<option>RI</option>
<option>SC</option>
<option>SD</option>
<option>TN</option>
<option>TX</option>
<option>UT</option>
<option>VT</option>
<option>VA</option>
<option>WA</option>
<option>WV</option>
<option>WI</option>
<option>WY</option>
</select>
</label></td>
</tr>
<tr>
<td class="td">Email</td>
<td colspan="3"><span id="sprytextfield3">
<label>
<input name="Email" type="text" class="test" id="Email" size="35" />
</label>
<span class="textfieldRequiredMsg">Required</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
</tr>
<tr>
<td height="26" class="td">Confirm Email</td>
<td colspan="3"><span id="spryconfirm1">
<label>
<input name="Confirm Email2" type="text" class="test" id="Confirm Email2" size="35" />
</label>
<span class="confirmRequiredMsg">Required</span><span class="confirmInvalidMsg">The values don't match.</span></span></td>
</tr>
<tr>
<td height="26" class="td">Photo(s)</td>
<td colspan="3"><label>
<input name="Photo" type="file" class="test" id="Photo" size="35" />
</label></td>
</tr>
<tr>
<td height="131" class="td">Additional Details</td>
<td colspan="3"><label>
<textarea name="Additional Details" cols="40" rows="6" class="test" id="Additional Details"></textarea>
</label></td>
</tr>
</table>
<p>
<label>
<input name="Submit" type="submit" class="test" id="Submit" value="Post" />
</label>
</p>
<input type="hidden" name="MM_insert" value="individual" />
</form>
SERVER BEHAVIOR
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "individual")) {
$insertSQL = sprintf("INSERT INTO donations (postingTitle, `size`, condition, length, color, city, `state`, email, photo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Posting Title'], "text"),
GetSQLValueString($_POST['size'], "text"),
GetSQLValueString($_POST['Condition'], "text"),
GetSQLValueString($_POST['Length'], "text"),
GetSQLValueString($_POST['Color'], "text"),
GetSQLValueString($_POST['City'], "text"),
GetSQLValueString($_POST['State'], "text"),
GetSQLValueString($_POST['Email'], "text"),
GetSQLValueString($_POST['Photo'], "text"));
mysql_select_db($database_bridesmaidsrack_db, $bridesmaidsrack_db);
$Result1 = mysql_query($insertSQL, $bridesmaidsrack_db) or die(mysql_error());
$insertGoTo = "donations.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $insertGoTo));
DATABASE CONNECTION
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_bridesmaidsrack_db = "localhost";
$database_bridesmaidsrack_db = "bridesmaidsrack";
$username_bridesmaidsrack_db = "";
$password_bridesmaidsrack_db = "";
$bridesmaidsrack_db = mysql_pconnect($hostname_bridesmaidsrack_db, $username_bridesmaidsrack_db, $password_bridesmaidsrack_db) or trigger_error(mysql_error(),E_USER_ERROR);Hi David,
I did as you recommended. For good measure, I even changed the case of the letters to make sure that they coincide with exactly what's in the database. I still kept getting the same error message. So I deleted the recordset and attempted to recreate it. When I attempted to recreate the record set, I got the following error message: "RangeError: invalid array length". My codes are listed below:
Form:
<form method="POST" enctype="multipart/form-data" name="individual" class="individual" id="individual">
<table width="594" border="0" class="test">
<tr></tr>
<tr>
<td width="166" class="td">Posting Title</td>
<td colspan="3"><span id="sprytextfield1">
<label>
<input name="posting_title" type="text" class="test" id="posting_title" size="35" />
</label>
<span class="textfieldRequiredMsg">Required</span></span></td>
</tr>
<tr>
<td class="td">Size(s)</td>
<td colspan="3"><label>
<select name="size" size="1" multiple="multiple" class="test" id="size">
<option>0</option>
<option>2</option>
<option>4</option>
<option>6</option>
<option>8</option>
<option>10</option>
<option>12</option>
<option>14</option>
<option>16</option>
<option>18</option>
<option>20</option>
<option>22</option>
<option>24</option>
<option>26</option>
</select>
<span class="Text">To select multiple sizes, hold ctrl and select each size.</span></label></td>
</tr>
<tr>
<td class="td">Condition</td>
<td colspan="3"><label>
<select name="condition" class="test" id="condition">
<option>New</option>
<option>Used</option>
</select>
</label></td>
</tr>
<tr>
<td class="td">Length</td>
<td colspan="3"><label>
<select name="length" class="test" id="length">
<option>Long</option>
<option>Short</option>
<option>Mid-Length</option>
</select>
</label></td>
</tr>
<tr>
<td class="td">Color(s)</td>
<td colspan="3" class="td"><span id="sprytextfield5">
<label>
<input name="color" type="text" class="test" id="color" size="35" />
</label>
<span class="textfieldRequiredMsg">Required</span></span></td>
</tr>
<tr>
<td class="td">City</td>
<td class="td"><span id="sprytextfield4">
<label>
<input name="city" type="text" class="test" id="city" size="35" />
</label>
<span class="textfieldRequiredMsg">Required</span></span></td>
<td class="td"> </td>
<td class="td"> </td>
</tr>
<tr>
<td class="td">State</td>
<td colspan="3"><label>
<select name="state" class="test" id="state">
<option>AL</option>
<option>AK</option>
<option>AZ</option>
<option>AR</option>
<option>CA</option>
<option>CO</option>
<option>CT</option>
<option>DE</option>
<option>DC</option>
<option>FL</option>
<option>GA</option>
<option>HI</option>
<option>ID</option>
<option>IL</option>
<option>IN</option>
<option>IA</option>
<option>KS</option>
<option>KY</option>
<option>LA</option>
<option>ME</option>
<option>MD</option>
<option>MA</option>
<option>MI</option>
<option>MN</option>
<option>MS</option>
<option>MO</option>
<option>MT</option>
<option>NE</option>
<option>NV</option>
<option>NH</option>
<option>NJ</option>
<option>NM</option>
<option>NY</option>
<option>NC</option>
<option>ND</option>
<option>OH</option>
<option>OK</option>
<option>OR</option>
<option>PA</option>
<option>RI</option>
<option>SC</option>
<option>SD</option>
<option>TN</option>
<option>TX</option>
<option>UT</option>
<option>VT</option>
<option>VA</option>
<option>WA</option>
<option>WV</option>
<option>WI</option>
<option>WY</option>
</select>
</label></td>
</tr>
<tr>
<td class="td">Email</td>
<td colspan="3"><span id="sprytextfield3">
<label>
<input name="email" type="text" class="test" id="email" size="35" />
</label>
<span class="textfieldRequiredMsg">Required</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
</tr>
<tr>
<td height="26" class="td">Confirm Email</td>
<td colspan="3"><span id="spryconfirm1">
<label>
<input name="confirm_email2" type="text" class="test" id="confirm_email2" size="35" />
</label>
<span class="confirmRequiredMsg">Required</span><span class="confirmInvalidMsg">The values don't match.</span></span></td>
</tr>
<tr>
<td height="26" class="td">Photo(s)</td>
<td colspan="3"><label>
<input name="Photo" type="file" class="test" id="Photo" size="35" />
</label></td>
</tr>
<tr>
<td height="131" class="td">Additional Details</td>
<td colspan="3"><label>
<textarea name="Additional Details" cols="40" rows="6" class="test" id="Additional Details"></textarea>
<input name="hiddenField" type="hidden" id="hiddenField" value="Date" />
</label></td>
</tr>
</table>
<p>
<label>
<input name="Submit" type="submit" class="test" id="Submit" value="Post" />
</label>
</p>
</form>
Server Behavior
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "individual")) {
$insertSQL = sprintf("INSERT INTO donations (posting_title, `size`, condition, length, color, city, `state`, email, photo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['posting_title'], "text"),
GetSQLValueString($_POST['size'], "text"),
GetSQLValueString($_POST['condition'], "text"),
GetSQLValueString($_POST['length'], "text"),
GetSQLValueString($_POST['color'], "text"),
GetSQLValueString($_POST['city'], "text"),
GetSQLValueString($_POST['state'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['Photo'], "text"));
mysql_select_db($database_bridesmaidsrack_db, $bridesmaidsrack_db);
$Result1 = mysql_query($insertSQL, $bridesmaidsrack_db) or die(mysql_error());
$insertGoTo = "donations.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $insertGoTo)); -
PHP MySQL NULL Values ??
Hi,
I am trying to implement a CMS in Dreamweaver MX 2004 using
PHP MySQL. My Product table contains fields that are not relavent
to all products and at the moment i have given these the value
NULL. Is there anyway for dreamweaver not to display the NULL
fields or is my problem with the database.
Thanks for any help,
IanOn Sun, 22 Oct 2006 16:53:07 +0000 (UTC), "irl_123"
<[email protected]> wrote:
>Hi,
> I am trying to implement a CMS in Dreamweaver MX 2004
using PHP MySQL. My
>Product table contains fields that are not relavent to
all products and at the
>moment i have given these the value NULL. Is there anyway
for dreamweaver not
>to display the NULL fields or is my problem with the
database.
> Thanks for any help,
> Ian
Something like this:
if (!is_null(your recordset field here)) {
//show the recordset field
Steve
steve at flyingtigerwebdesign dot com -
PHP / MySQL / Stored Procedures
I'm trying to call a stored procedure on my site which uses
php / mySQL 5.x. I've got the procedure working in the database so
that when I call it from within a MySQL client it executes and
returns the results I need, but Dreamweaver doesn't even "see" the
stored procedure.
By this I mean If I use the recordset wizard, go to advanced,
select the relevant database and then expand the Stored Procedures
tab none are listed.
Searching through Adobe help, it lists nothing about Stored
Procedures with PHP/MySQL apart from that MySQL doesn't support
them. The later versions of MySQL do support Stored Procedures, but
has anyone got them working with Dreamweaver? If so how!??!!
Any help much appreciated.Talk Rowing wrote:
> Well thanks for setting me straight - even if you are
the bearer of bad news.
> I've filed a feature request as you suggested. Can't
believe Adobe don't offer
> this.
Stored procedures have been available in MySQL only since
version 5.0,
which was released in October 2005, one month after
Dreamweaver 8. It
would have been nice to include support for stored procedures
in CS3,
but no new functionality was added to any of the server-side
features of
Dreamweaver. I have my fingers crossed for next time.
> On another note I don't suppose you could point me in
the direction of some
> tutorials on how to create a recordset from a stored
procedure manually? I've
> tried google and not come across a lot...
My server doesn't support MySQL 5.0, so apart from the
information in
the MySQL documentation, I don't know a great deal about
using stored
procedures:
http://dev.mysql.com/doc/refman/5.0/en/stored-procedures.html
One of the problems is that many hosting companies are still
using older
versions of MySQL (a lot still offer only 3.23). I'm
currently in the
process of moving to a new server with support for both PHP 5
and MySQL
5.0. Once I've had time to experiment, I hope to know a lot
more.
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
PHP/MySQL Relational Database
Hi,
I am fairly new to php/MySQL. I am stuck on how to make a cross linking database.
I have two tables "users" and "comments" and would like to set up a page that a logged in user can see and edit the comments they have made.
So far I have tried to make an advanced recordset but all i have managed to do is display all of the records that share a user_id.
I am using dreamweaver CS5.5 and PHP and MySQL.
Thanks in advance for your help
EddieThat should just be a basic query to SELECT * FROM {comment-tbl} WHERE userid = $_SESSION['user'].
Are you using Sessions or Cookies at this point or are you just trying to write this into a query without them?
Maybe you are looking for
-
WxWidgets, Mac and Acrobat 9 SDK
We are having a lot of problems in the Mac using wxWidgets whch have now started using as a cross platform replacement to ADM. On MacOS 10.4 (Tiger): Having the sample 'wxPlugin' from the Acrobat 9 SDK samples-folder installed in either Acrobat 9 Pro
-
Issues with opening CR2 raw files in CS4
I have a Cannon EOS 60D Camera and I also have photoshop CS4. When I try to open my raw photos into CS4, it does not recognise the file and says words to the effect of "this file is not recognised". I tried to install the 5.3 plug in but this did not
-
Hi; I'm trying to learn flash builder. Making a simple application used tab views. I designed the page, but when I switch orientation, some objects not seen on a screen. How can I adding auto orientation to my application. peace
-
Illustrator won't transform images!!
Hi everryone. I tryed pressing ctl + T on windows illustrator to transform, it did it before but now theres a red line around my image and I can't edit it, does anyone know what im doing wrong? thanks Helen c
-
Hi Experts, I want to practice on XI scenarios Please provide me the links for all scenarios. Please provide me the blogs which are having complete IR and ID settings. How many scenarios i have to work so that i can handson on all kind of adapters. P