General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old February 27th, 2003, 04:05 AM
Lizzy Lizzy is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: near Amsterdam
Posts: 10 Lizzy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question WYSIWYG - Can read, can't write to db.

i've got a little problem with EditWorksPro. I'm trying to get data out of a MySQL database, edit it, and put it back in.
Well so far so good. With the help files i’ve got it done. BUT...
i use this as navigation:
PHP Code:
<?
for ($x=0$x count($db0->result); $x++){
        echo(
"
        <tr>
        <td width='45'>
        <A href='test.php?id="
.$db0->result[$x][0]."'>".$db0->result[$x][1]."</A>
        </td>
        </tr>
            
        "
);
    }
?>



well this is the script i'm talking about
PHP Code:
<?
$c 
mysql_connect($dbServer$dbUser$dbPass) or die("Couldn't connect to database");
$d mysql_select_db($dbName) or die("Couldn't select database");

if(@
$_POST["save"] == "true")
{
$content $myEW->GetValue(true);
$result = @mysql_query("update myTable set content = '$content' where id = '$id'");


echo 
"Content.php $id saved!<br><br><a href='test.php?id=$id'>Continue</a>";
}
else
{
$result mysql_query("select content from myTable where id = '$id'");

if(
$row mysql_fetch_array($result))
$data $row["content"];
else
$data "";

$myEW->SetValue($data);
?>


if I put for example ' where id = 2' everything works fine. He opens the page with ?id=2 and saves it the right way. But when i put ' where id = '$id' . He won't save correctly although he does read the right page. So he does open the page with the correct id...... But he looses his identity halfway through.

i'm confused

Reply With Quote
  #2  
Old February 27th, 2003, 05:07 AM
fakker fakker is offline
The calm b4 the storm
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Manchester, UK
Posts: 404 fakker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via Yahoo to fakker
hey, I'm not sure if this will make a difference, but at first glance, if the $id is a integer in the database, I think you could try removing the ' ' quotes around the $id....

so it would be

PHP Code:
 $result mysql_query("select content from myTable where id = $id"); 
__________________
Matt 'Fakker' Facer

mattfacer.com

Reply With Quote
  #3  
Old February 27th, 2003, 06:03 AM
Lizzy Lizzy is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: near Amsterdam
Posts: 10 Lizzy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy

nop
still nothing happens

Reply With Quote
  #4  
Old February 27th, 2003, 07:41 AM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
Question for you Lizzy, where are you declaring $id ? are you passing it through to the script via URL? I don't see it in the script.. try adding this code in and see if it helps..

PHP Code:
 $id $_GET['id'];
if (!
$id){
    
$id $_POST['id'];



Just a thought.. I didn't see where you were declaring it anywhere in the code

Hope it helps

Reply With Quote
  #5  
Old February 27th, 2003, 04:40 PM
Lizzy Lizzy is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: near Amsterdam
Posts: 10 Lizzy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking WHOOPEE!

IT WORKSSSSSSSSSSSSS!!!!!

i'm so happy!

i'm so blond and/or female
well blond i am not
so it has to be the female part
i just had to put the $id in the url in the form

<form action="test.php?id=<? echo($id) ?>" method="post">

duhh

* feels stupid but also very very happy

thanx for your input
now i can go to sleep without dreaming php


Reply With Quote
  #6  
Old February 27th, 2003, 04:43 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
No worries I'm glad I could help ya out! Sometimes it just takes someone who doesn't have as much experience as everyone else <namely myself! though I am coming up in the PHP world > to look at it from another perspective.. sometimes it's an easy answer that is just staring at you, sometimes it's a toughie.. either way.. as long as it gets resolved

Glad to be of assistance

Reply With Quote
  #7  
Old March 28th, 2003, 09:43 PM
aarontm aarontm is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 1 aarontm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
$_REQUEST["var_name"]

FYI as opposed to checking both $_GET & $_POST you can just use $_REQUEST["var_name"], which will access get and post vars automatically

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > WYSIWYG - Can read, can't write to db.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway