Jump to content

Archived

This topic is now archived and is closed to further replies.

khan kaka

using dream weaver and php and sql

Recommended Posts

i use dream weaver and php and sql to save my news in data base but when i disply my news on web page i lose text format.

 

i dont lose ( spaces) but i lose ( enters ) or new lines or in html ( </br> )

when i check my data in data base each new nline is marked ( /n) and when i try to display it on html page i lose the enters. any hlep its driving me crazy .

 

and this is how i disply the news on my page

<TD align=center bgColor=#dcdcdc class=NavMainLeft height=15

width=181> <?php echo $row_live['content']; ?> </TD>

 

and in data base i have set the ( content ) field to ( text )

plz help

Share this post


Link to post
Share on other sites

IT shoud look like this

<?php echo nl2br($row_rsJournal['body']); ?>

 

You can acheve this by selecting the record set information you need to modify (on the layout page not in the code Panel.

 

Then in your Applications panel Change the "Format" to Newslines to BR

 

Or I thinkyou can just enter nl2br in the code line

 

 

Share this post


Link to post
Share on other sites
IT shoud look like this

<?php echo nl2br($row_rsJournal['body']); ?>

 

You can acheve this by selecting the record set information you need to modify (on the layout page not in the code Panel.

 

Then in your Applications panel Change the "Format" to Newslines to BR

 

Or I thinkyou can just enter nl2br in the code line

thanks very very very much you saved my day.

 

yes it did work and i was going crazy with it. :D thanks agin.

Share this post


Link to post
Share on other sites

it bugged me for a while too, I knew there was an easy answer I just pushed alot of buttons till I found it.

 

Glad I could help,

 

Josh

Share this post


Link to post
Share on other sites

hi josh one more problem i have

 

how can i make a search code for php in dream weaver .

 

thanks alot . :rolleyes:

Share this post


Link to post
Share on other sites

I assume you mean a recordset.

 

You want to search buy something inputed into a text field?

 

 

Share this post


Link to post
Share on other sites

yes , i have a form and i want to be able to search text and names and phone numbers in data base.

 

 

Share this post


Link to post
Share on other sites
yes , i have a form and i want to be able to search text and names and phone numbers in data base.

nice name khan kaka. where are you from? :D

Share this post


Link to post
Share on other sites

I might be able to explain this in words let me see.

 

You need to create a PHP page with a form

name the page what ever you wish name the form search.

 

Now figure out if you want the results to show on the same page or on another.

If you want the results on the same page then find your form properties and link the form to the page you are working on. If you want the results on another page

start a page, save it and link the form properties to the new page.

 

Now you need to create a record set. I beleive you are going to have a search form for each element you want to search

 

phone number search

name search

text search

 

Each search will need it's own record set.

 

Buildint he record set is very easy follow the steps when you opent the screen

 

Here you determine what you want to oull from the db and how.

 

Here is a link to a screen shot explaining some of it.

 

http://new.flightfeathers.com/Images/Jeep/MXScreen.jpg

 

Here you can see how I want to pull the info like Date, Venue, INfo, and date added.

 

And I want it to be pulled table "josh_concert"

 

when the date = what is in the pulldown (the pull down is no different then a text field).

 

Where 'date' = colname is the line that makes it look for entered information however we have to define this in variables hence

 

Colname 1 $_POST['DateSearch']

 

Date Search is what I have named the text field it wants to match the info up for.

 

THen you will have a record set completed, and you just have to place the results where you want them to display.

 

(The blue parts of the page)

 

Simply drag them from the record set menu in the upper right and place them where you want them.

 

Note if you want them pulled on a seperate page then you have to make the same record set on the second page and diplay results as you want.

 

 

I hope this helps some, I am not so good as explaining but I hope the image will help too.

 

Josh

 

 

 

Share this post


Link to post
Share on other sites

hi josh

 

how you doing. i did exactly as you asked me but my search does'nt return any result.

 

my text field on my search form is called ( searchdata )

and i am trying to search by ( id ) on table called ( titlebukhari )

 

and here is a screen shot of my recordset but it doest work.

 

http://66.135.34.37/noned/test/screen%20shot.jpg

 

i realy appretiate your help. :blink:

Share this post


Link to post
Share on other sites

Did you link the form to the page you are working on as it has to reload that page.

 

So the link for the from should be to form.php if that is where your results display.

 

In last case senerio if you want to you can email me the php page and I will open it and look at it form here just to besure.

 

josh-jones@comcast.net

 

 

Let me know we will get it working!!!

Share this post


Link to post
Share on other sites

You should have Email I got the file and found a few problems and sent it back.

 

Josh

Share this post


Link to post
Share on other sites

Your Email would not go through :( Copied and pasted here

 

Elyas,

 

I found a few issues with your page I will try to explain them.

 

First off you had your Form linked to form.php not form1.php

 

The Record Set had a few problems. Your origonal looked like:

 

SELECT 'id', title1, hadithid

FROM bukharititle

WHERE 'id' = 'colname'

 

I belive when you use 'id' it means the word not the actual values (I am

not sure about this but when I tested it searching by hadithid it it woudl

only diplay id in the table not the actual id number. For some reason it was

placing <?php echo id;?> in the form not the result of the record set.

 

I changed the query to this

 

SELECT id, title1, hadithid

FROM bukharititle

WHERE hadithid = 'colname'

 

I did this for two reasons getting rid of the 'id' and making it just id

will now bring up the actual number, searching by the id is not a very good

idea (in my opinion) because that is set by the table not you, and I assume

you know what the corresponding hadithid is so that provides a better search

you may change this if you wish by simply changing the WHERE clause to say

id not hadithid. One issue with seaching by id is (again I am assuming just

because I cannot get it to work right and do not have all the answers) when

you search by id it will always fill the first row of the whether there is a

value or not when you open the page there will be a default result even

before you search, however how you nwat to set that up is up to you.

 

I hope this helps I am sending you back your php file as I have edited it,

you will have to change the connection string as I did not know what yours

was, ans you will have to change the record set as I made a new one using my

connection, and it will not work on your server. Just follow the text above

and you shoudl be all set. You can also just edit your as I have, and

youshoudl be okay.

 

The one to remember is the form link, you have ot point that to form1.php as

that is the location of the results.

 

Hope this helps

 

Joshua Jones

Share this post


Link to post
Share on other sites

yes i did work . :D

 

thanks mate you saved my day again. and as to my email I get my other emails.

 

don't know what is wrong with it.

 

can I bother you again for more help?

 

one more question if u have time and not too busy you can help me on this one too.

 

how can I preview the data that just inserted in data base through insert form.

 

the insert recordset dose gave me an option to go any page after inserting but how can I just display the record just added.

 

on preview page I tried the recordset to display the very last record, but its not accurate if two or three person insert information at the same time and one had a cable or faster connection then other one the slow connection will see the very last record in data base and that is the wrong record.

 

is there anyway I can pass the id of the inserted data to preview or any other options.

 

cheers joshh .

 

thanks for you help .

Share this post


Link to post
Share on other sites

I have never done it, but I am not sure it is possible. Though it could be

 

What I think you might want to do is have a preview page to look at the info you just supplied to make sure it is right before you actaully insert it. I beleive that is done with hidden form fields holding the info and passing them to the next page.

 

If you have trouble I can try a few things to make what you need and see if I can explain it.

 

Not that I think of it though you could build a page that will just display the last part added buy making a query that displays by the id decsending

 

so it woudl be

 

SELECT 'id', title1, hadithid

FROM bukharititle

order id DESC

 

if you only allow one record to show it will always be the last one.

 

So when you enter the data and submit direct that page to a page running the above recordset, and you shoudl see what you just entered.

 

I have not tested this but it makes sence in theory.

 

 

Good Luck

Josh

 

Any questions let me know

Share this post


Link to post
Share on other sites

yes josh you are right i did try this before to have a preview page to display the last record on table but, there is a catch to it.

 

if two person tries to enter data at the same time one with fast connection and one wiht slow conection.

 

the one with slow connection will interst his data and will preview the detial of person wiht fast connection.

 

by the time has connectin excutes the command and inserts data nd dispalys the data the secound prson wiht fast connection will insert his data first and secounds person data will be the last one on table and slow connection will disply last record and its wrong record. but i guess as u said to be on safe side its better to carry it to preview page wiht hidden fields then insert it.

 

thanks for suggestion.

 

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.