# The Best Angle To Create This PHP/MYSQL Site

**URL:** <https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894>\
**Category:** Uncategorized\
**Created:** [May 2, 2003, 3:42pm UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894 "2003-05-02T15:42:06Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamapathy](https://avatars.discourse-cdn.com/v4/letter/i/ac8455/32.png) [@iamapathy](https://forum.kirupa.com/u/iamapathy)\
**Post date:** [May 2, 2003, 3:42pm UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894/1 "2003-05-02T15:42:06Z")

</div>

Hi, im trying to figure out the best way to create this PHP/MYSQL website. It has news and events which will be stored in a MYSQL database.

To insert data I will create a insert form.

To update data I want the exisiting rows to be listed in a list menu, so that I can select it, and then have it bring up a page where it would load the current data from the database into an editable form. At which point when complete with the editing, it would update the database.

And to delete a database, the user will simply select the row and click the delete button to delete it.

And then on the actual page, the link will be ‘[http://my.domain/news.php?pageid=someVariable](http://my.domain/news.php?pageid=someVariable)’ where someVariable is the name of the page. How will I be able to tell the database to choose to bring in all the data that has to do with someVariable. I know it will have to look something like this, ‘SELECT \* FROM news WHERE pageid=$pageid’ but having not done this before, I am unsure of how to do it efficently.

Can anyone give guidance on any of the issues I have? Also is it wise to do multiple queries in one php page?

Thanks,  
Jordan.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 3, 2003, 5:51am UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894/2 "2003-05-03T05:51:54Z")

</div>

That is exactly what you should do! It is ike doing a search. You first search your database the value of pageid.

```php
SELECT * FROM news WHERE pageid = $pageid

```

You have to place that in a variable so you can use the information it returns to you:

```php

$select = mysql_query('SELECT * FROM news WHERE pageid = $pageid');

$row = mysql_fetch_array($select);
echo '$row[pageid]';

```

It’s been a long time since my last PHP scripting but I think this is the basic structure for your problem.

Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 5, 2003, 4:09pm UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894/3 "2003-05-05T16:09:31Z")

</div>

> \*Originally posted by comicGeek \*  
> \*\*

```php

$row = mysql_fetch_array($select);
echo '$row[pageid]';

```

\*\*

Thanks, but isn’t that code, simply pulling out the information and listing it? Is there a way to make certain mySQL cells appear in certain areas of the page, using the method you used? I mean I know there is a way, but I’m very new to this.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 6, 2003, 2:22am UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894/4 "2003-05-06T02:22:30Z")

</div>

I don’t know about that but I think the theory is placing the variable “$row[pageid]” inside a useful html code to display it instead of using “echo”.

Just explore this:

```php

echo '<textarea name="test">'.$row[pageid].'</textarea>';

```

I hope you can get it to work. I myself am new to PHP and MySQL. If you want visit this link for tutorials:

[www.robouk.com](http://www.robouk.com)

Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 6, 2003, 4:52pm UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894/5 "2003-05-06T16:52:49Z")

</div>

> \*Originally posted by comicGeek \*  
> \*\*I don’t know about that but I think the theory is placing the variable “$row[pageid]” inside a useful html code to display it instead of using “echo”.

Just explore this:

```php

echo '<textarea name="test">'.$row[pageid].'</textarea>';

```

I hope you can get it to work. I myself am new to PHP and MySQL. If you want visit this link for tutorials:

[www.robouk.com](http://www.robouk.com)

Cheers! \*\*

so what if instead of using the ‘pageid’ in $row[pageid] i used ‘news’, where news was the name of the cell, i wanted to retrieve?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 6, 2003, 4:54pm UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894/6 "2003-05-06T16:54:15Z")

</div>

by the way, nice site, i love the look… minus all the smiley faces 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 7, 2003, 5:20am UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894/7 "2003-05-07T05:20:41Z")

</div>

yeah you can can that depends on what the information on the database you wanted to retrieve.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 7, 2003, 2:09pm UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894/8 "2003-05-07T14:09:19Z")

</div>

Cool, any insight on how to create listbox entry chooser for loading the data into editable text areas and for deleting?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 2:02am UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894/9 "2003-05-08T02:02:00Z")

</div>

I really haven’t explored on that area before. I think the theory is the same. :-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 10, 2003, 2:58pm UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894/10 "2003-05-10T14:58:01Z")

</div>

> \*Originally posted by comicGeek \*  
> \*\*I really haven’t explored on that area before. I think the theory is the same. :-\ \*\*

it’s ok, i managed to figure it out… thanks (-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 12, 2003, 3:06pm UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894/11 "2003-05-12T15:06:02Z")

</div>

The next issue i have, is trying to display the most recent news articles…

I want to be able to display three news articles, which are not unposted. The question is how can this be done?

Initially this is what i was thinking…

```php

SELECT * FROM news WHERE id > max(id)-3 & unposted = null

```

‘max(id)-3 & unposted = null’ is just something that i wrote which is not mysql, but hopefully will help yu see what i am doing.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 21, 2003, 2:16pm UTC](https://forum.kirupa.com/t/the-best-angle-to-create-this-php-mysql-site/19894/12 "2003-05-21T14:16:22Z")

</div>

actually i figured that out too, with this mysql query

```php

SELECT * FROM news WHERE unposted IS NULL ORDER BY id DESC LIMIT 3

```

although i do have another problem which is,

creating a calender database, which display events which are annual as well as events that only happen once.
