PHP Insert
I have been working on this function – the idea is to read the meta tags – find the description – then insert the description in a db table.
I got the first two parts working – but cannot get the description to insert. I think I might need to do something to the array – i.e. addslashes or something – but, everything I try it does not seem to work. The odd thing is that I can echo the description ($value) but cannot insert it.
function getSiteMeta($description){
$tags = get_meta_tags($description);
if(sizeof($tags)==0){
echo 'No Description Found';
foreach($tags as $key=>$value) {
if($key!=description) {
unset ($value);
else
mysql_query("INSERT INTO page (page_description) VALUES ($value)");
echo $value;
Can someone provide a little guidance – please.
The obvious thing that's wrong with your original code is that $value needs to be in single quotes in the SQL query.
mysql_query("INSERT INTO page (page_description) VALUES ('$value')");
Similar Messages
-
Oracle and PHP - insert special characters problem
I have computer with these software:
Fedora Core 4
Apache 2.0.54
PHP 5.0.4
Oracle 10.2.0
Firefox (character set: UTF8)
System environment:
[oracle@computer /] echo $ORACLE_HOME
/db/u01/app/oracle/product/10.2.0/db_1
[oracle@computer /] echo $NLS_LANG
SLOVENIAN_SLOVENIA.AL32UTF8
I get this for every user, because I have in /etc/profiles:
NLS_LANG=SLOVENIAN_SLOVENIA.AL32UTF8; export NLS_LANG;
ORACLE_HOME=/db/u01/app/oracle/product/10.2.0/db_1; export ORACLE_HOME;
Oracle NLS parameters:
SQL> SELECT NLS_LANGUAGE, NLS_TERRITORY, NLS_CHARACTERSET FROM NLS_DATABASE_PARAMETERS;
SLOVENIAN, SLOVENIA, AL32UTF8
And similar for NLS_INSTANCE_PARAMETERS and NLS_SESSION_PARAMETERS.
phpinfo() returns:
Apache Environment
Variable Value
NLS_LANG SLOVENIAN_SLOVENIA.AL32UTF8
In /etc/php.ini I have:
default_charset = "UTF-8"
mbstring.internal_encoding = UTF-8
In /etc/httpd/conf/httpd.conf:
SetEnv NLS_LANG SLOVENIAN_SLOVENIA.AL32UTF8
In my PHP script "oracle.php" (file encoding is UTF-8) I have:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" >
putenv("NLS_LANG=SLOVENIAN_SLOVENIA.AL32UTF8");
And then code similar to Example 2 in: http://www.php.net/manual/en/ref.oci8.php
Problem
When I am trying with PHP insert character "" ( http://www.fileformat.info/info/unicode/char/0161/index.htm ) or some other special character into Oracle table and then do SELECT from this table I get value "??" which is wrong.
There is no problem for example with char "a". There is no problem inserting data with SQLPlus or Toad for Oracle - inserted data is always correct. There is no problem for example with echo("some_special_sharacters"); in PHP. I have no problems inserting data with PHP to MySQL database.
I have read this, but problem still exists:
http://www.oracle.com/technology/tech/php/pdf/globalizing_oracle_php_applications.pdf
Plese help.
Thanks!How do you insert it? How do you select it? Where are you viewing the character? What is in the database after the INSERT?
(SELECT DUMP(col,1016) FROM tab)
-- Sergiusz -
Hello everybody, im a novice on Developpement using Flex.
im working on a project which will be runned on BlackBerry Tablet (PlayBook), im using FlashBuilder Burrito + AIR SDK
my project is a CRUD application, so i follow this tutorial http://www.adobe.com/devnet/flex/testdrivemobile/articles/mtd_1_1.html and it works
now i try to do the same things on my DataBase, i can retrieve data but i can't Insert or Delete ...
this is the code of my application :
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:valueObjects="valueObjects.*"
xmlns:affiliesservice="services.affiliesservice.*"
title="Accueil">
<fx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
protected function saveBtn_clickHandler(event:MouseEvent):void
aff.longitude=11111.1;
aff.lattitude=11111.3;
createAffilies(aff);
protected function createAffilies(item:Affilies):void
createAffiliesResult.token = affiliesService.createAffilies(item);
protected function createAffiliesResult_resultHandler(event:ResultEvent):void
navigator.popView();
navigator.pushView(ajoutValides);
]]>
</fx:Script>
<fx:Declarations>
<valueObjects:Affilies id="aff" />
<s:CallResponder id="createAffiliesResult" result="createAffiliesResult_resultHandler(event)"/>
<affiliesservice:AffiliesService id="affiliesService"/>
</fx:Declarations>
<s:Scroller left="0" right="0" top="0" bottom="103">
<s:VGroup x="38" y="110" width="100%" height="100%" gap="15" paddingBottom="15"
paddingLeft="15" paddingRight="15" paddingTop="15">
<s:Label text="Nom"/>
<s:TextInput width="100%" text="@{aff.nom}"/>
<mx:Spacer height="5"/>
<s:Label text="Adresse"/>
<s:TextInput width="100%" text="@{aff.adr}"/>
<mx:Spacer height="5"/>
<s:Label text="Telephone"/>
<s:TextInput width="100%" text="@{aff.tel}"/>
<mx:Spacer height="5"/>
<s:Label text="Url"/>
<s:TextInput width="100%" text="@{aff.lien}"/>
<mx:Spacer height="5"/>
</s:VGroup>
</s:Scroller>
<s:Button id="saveBtn" left="10" bottom="10" width="45%" label="Save"
click="saveBtn_clickHandler(event)"/>
<s:Button id="cancelBtn" right="17" bottom="10" width="45%" label="Cancel"/>
</s:View>
and for the service i generate it automatically and this is the code :
<?php
* README for sample service
* This generated sample service contains functions that illustrate typical service operations.
* Use these functions as a starting point for creating your own service implementation. Modify the
* function signatures, references to the database, and implementation according to your needs.
* Delete the functions that you do not use.
* Save your changes and return to Flash Builder. In Flash Builder Data/Services View, refresh
* the service. Then drag service operations onto user interface components in Design View. For
* example, drag the getAllItems() operation onto a DataGrid.
* This code is for prototyping only.
* Authenticate the user prior to allowing them to call these methods. You can find more
* information at http://www.adobe.com/go/flex_security
class AffiliesService {
var $username = "root";
var $password = "root";
var $server = "localhost";
var $port = "3306";
var $databasename = "expressway";
var $tablename = "affilies";
var $connection;
* The constructor initializes the connection to database. Everytime a request is
* received by Zend AMF, an instance of the service class is created and then the
* requested method is invoked.
public function __construct() {
$this->connection = mysqli_connect(
$this->server,
$this->username,
$this->password,
$this->databasename,
$this->port
$this->throwExceptionOnError($this->connection);
* Returns all the rows from the table.
* Add authroization or any logical checks for secure access to your data
* @return array
public function getAllAffilies() {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM affilies");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
* Returns the item corresponding to the value specified for the primary key.
* Add authorization or any logical checks for secure access to your data
* @return stdClass
public function getAffiliesByID($itemID) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where id=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $itemID);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
if(mysqli_stmt_fetch($stmt)) {
return $row;
} else {
return null;
* Returns the item corresponding to the value specified for the primary key.
* Add authorization or any logical checks for secure access to your data
* @return stdClass
public function createAffilies($item) {
$stmt = mysqli_prepare($this->connection, "INSERT INTO affilies (nom, adr, tel, longitude, lattitude, lien) VALUES (?, ?, ?, ?, ?, ?)");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'sssdds', $item->nom, $item->adr, $item->tel, $item->longitude, $item->lattitude, $item->lien);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$autoid = mysqli_stmt_insert_id($stmt);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $autoid;
* Updates the passed item in the table.
* Add authorization or any logical checks for secure access to your data
* @param stdClass $item
* @return void
public function updateAffilies($item) {
$stmt = mysqli_prepare($this->connection, "UPDATE $this->tablename SET nom=?, adr=?, tel=?, longitude=?, lattitude=?, lien=? WHERE id=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'sssddsi', $item->nom, $item->adr, $item->tel, $item->longitude, $item->lattitude, $item->lien, $item->id);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
* Deletes the item corresponding to the passed primary key value from
* the table.
* Add authorization or any logical checks for secure access to your data
* @return void
public function deleteAffilies($itemID) {
$stmt = mysqli_prepare($this->connection, "DELETE FROM $this->tablename WHERE id = ?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $itemID);
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
* Returns the number of rows in the table.
* Add authorization or any logical checks for secure access to your data
public function count() {
$stmt = mysqli_prepare($this->connection, "SELECT COUNT(*) AS COUNT FROM $this->tablename");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $rec_count);
$this->throwExceptionOnError();
mysqli_stmt_fetch($stmt);
$this->throwExceptionOnError();
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rec_count;
* Returns $numItems rows starting from the $startIndex row from the
* table.
* Add authorization or any logical checks for secure access to your data
* @return array
public function getAffilies_paged($startIndex, $numItems) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename LIMIT ?, ?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'ii', $startIndex, $numItems);
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
* Utility function to throw an exception if an error occurs
* while running a mysql command.
private function throwExceptionOnError($link = null) {
if($link == null) {
$link = $this->connection;
if(mysqli_error($link)) {
$msg = mysqli_errno($link) . ": " . mysqli_error($link);
throw new Exception('MySQL Error - '. $msg);
?>
and i can't even find an error !! could anyone help me or even give me a solution to read the error report.
thx.so... while no one find the probleme or even give me an answer to it, i search another solution that correspond to my knowledge and i found : As-SQL it's easy to use and while u don't need to manage a lot of data this solution will be helpfull.
any way, even if i found another solution i still want to know the problem. -
Flex & PHP - Insert Query in Php Service
I have a MySql DB with 2 tables:
1. category - categoryID / category / description
2. photos - photoID / categoryID / photodescription / photo
And i have a service (CategoryService.php) automatically created by Flash Builder, but i cannot get the second table!!
<?php
class CategoryService {
var $username = "root";
var $password = "";
var $server = "localhost";
var $port = "3306";
var $databasename = "teste";
var $tablename = "category";
var $connection;
* The constructor initializes the connection to database. Everytime a request is
* received by Zend AMF, an instance of the service class is created and then the
* requested method is invoked.
public function __construct() {
$this->connection = mysqli_connect(
$this->server,
$this->username,
$this->password,
$this->databasename,
$this->port
$this->throwExceptionOnError($this->connection);
* Returns all the rows from the table.
* Add authroization or any logical checks for secure access to your data
* @return array
public function getAllCategory() {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->categoryId, $row->category, $row->description);
while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->categoryId, $row->category, $row->description);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
* Returns the item corresponding to the value specified for the primary key.
* Add authorization or any logical checks for secure access to your data
* @return stdClass
public function getCategoryByID($itemID) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where categoryId=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $itemID);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $row->categoryId, $row->category, $row->description);
if(mysqli_stmt_fetch($stmt)) {
return $row;
} else {
return null;
* Returns the item corresponding to the value specified for the primary key.
* Add authorization or any logical checks for secure access to your data
* @return stdClass
public function createCategory($item) {
$stmt = mysqli_prepare($this->connection, "INSERT INTO $this->tablename (category, description) VALUES (?, ?)");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'ss', $item->category, $item->description);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$autoid = mysqli_stmt_insert_id($stmt);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $autoid;
* Updates the passed item in the table.
* Add authorization or any logical checks for secure access to your data
* @param stdClass $item
* @return void
public function updateCategory($item) {
$stmt = mysqli_prepare($this->connection, "UPDATE $this->tablename SET category=?, description=? WHERE categoryId=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'ssi', $item->category, $item->description, $item->categoryId);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
* Deletes the item corresponding to the passed primary key value from
* the table.
* Add authorization or any logical checks for secure access to your data
* @return void
public function deleteCategory($itemID) {
$stmt = mysqli_prepare($this->connection, "DELETE FROM $this->tablename WHERE categoryId = ?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $itemID);
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
* Returns the number of rows in the table.
* Add authorization or any logical checks for secure access to your data
public function count() {
$stmt = mysqli_prepare($this->connection, "SELECT COUNT(*) AS COUNT FROM $this->tablename");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $rec_count);
$this->throwExceptionOnError();
mysqli_stmt_fetch($stmt);
$this->throwExceptionOnError();
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rec_count;
* Returns $numItems rows starting from the $startIndex row from the
* table.
* Add authorization or any logical checks for secure access to your data
* @return array
public function getCategory_paged($startIndex, $numItems) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename LIMIT ?, ?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'ii', $startIndex, $numItems);
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->categoryId, $row->category, $row->description);
while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->categoryId, $row->category, $row->description);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
* Utility function to throw an exception if an error occurs
* while running a mysql command.
private function throwExceptionOnError($link = null) {
if($link == null) {
$link = $this->connection;
if(mysqli_error($link)) {
$msg = mysqli_errno($link) . ": " . mysqli_error($link);
throw new Exception('MySQL Error - '. $msg);
?>
In Flash Builder i have 2 spark List, the first one have all categorys and i want when "selectedItem" it populates the other one with the correspondent photos!! I have a query that works with the database but i cannot insert it into php. This is the query:
SELECT TC.*, TP.photodescription , TP.photo FROM category TC inner join photos TP on TC.categoryId = TP.categoryId
How can i do this!?
Hope it's understandable, thanks for "listening"..This is great, that's it!! Many thanks ;-)
Now i can get info from this function but i'm not sure how to manage it.
I have 2 spark List, the first one have all categorys and i want when "selectedItem", it populates the other one with the correspondent photos!!
This is my .mxml:
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
import spark.events.IndexChangeEvent;
protected function list_creationCompleteHandler(event:FlexEvent):void
getAllCategoryResult.token = categoryService.getAllCategory();
protected function list_changeHandler(event:IndexChangeEvent):void
category = list.selectedItem;
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getAllCategoryResult"/>
<categoryservice:CategoryService id="categoryService"
fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
showBusyCursor="true"/>
<valueObjects:Category id="category"/>
</fx:Declarations>
<s:List id="list" x="94" y="143" creationComplete="list_creationCompleteHandler(event)" change="list_changeHandler(event)"
labelField="category">
<s:AsyncListView list="{getAllCategoryResult.lastResult}"/>
</s:List>
<s:List x="672" y="143"></s:List>
What do i have to do now!?
Thanks again.. -
Hello,
I'm coming up blank on the basic logic to insert a record based on results gathered to a form page. Inserting txt field entry items are are no problem but I have a displayed value created by polling another table, collecting the results, then passes the results to the form page and if there are no results displays a message in place of "the results".
I now want to simply (or obviously not for me) include "the results" as one of the values I am inserting from the form as a new record.
Using this code I gather my list of Models selected:
Code:things grow cloudy....<br /><br />Seems I can only use the method once. IF used in the value of a text field it works:<br /><br /> <input type="text" name="selectedModels" id="selectedModels" value="<?php <br /> if ($totalRows_rsCookModels == 0) {<br /> echo ("No models selected") ; <br />} else { <br />do { <br /> echo $row_rsCookModels['model_name']; <br /> echo (", ") ;<br /> } while ($row_rsCookModels = mysql_fetch_assoc($rsCookModels)); }?>"><br /><br />But then the later same code used to display the results to screen fails:<br /><br /> <?php if ($totalRows_rsCookModels == 0) {<br /> echo ("No models selected") ; // Show if recordset empty <br />} else {<br /> do {<br /> echo $row_rsCookModels['model_name'];<br /> echo (", ") ;<br />} while ($row_rsCookModels = mysql_fetch_assoc($rsCookModels));<br /> }<br />?><br /><br />But that same latter code works when the form field code is removed.<br /><br />Is there something that is wiping out some available value? Does the recordset expire after use? I'm sure I could create a different named record set but that seems to be less efficient.<br /><br />Any idea what new logic I need to grasp to understand the problem? Again should I be creating a var value of the string so t can be used multiple times in the same page? Is that the logic that escapes me? Us?
-
PHP, INSERT FILNAME FIELD FROM FORM
I am trying to do a simple insert record into a MySQL
database and for the life of me I cannot get the file field
(<input name="photoNAME" type="file" id="photoNAME"
/>)
to insert into the database. I have three other fields that
do insert correctly the only one that won't go in is that field. I
can't even get the form field to echo to the screen.
Anyone have any idea why?
ThanksGary White wrote:
> On Wed, 21 Feb 2007 13:49:43 +0000 (UTC), "VernMan"
> <[email protected]> wrote:
>
>> (<input name="photoNAME" type="file"
id="photoNAME" />)
> See
http://www.php.net/manual/en/features.file-upload.php
As Gary indicates, using type="file" is for file uploads. If
all you're
trying to do is get the name of the file into a database,
there's no
need to upload the file. In fact, it's a total waste of
resources.
You need to use the PHP file system functions to build a list
of the
images in your folder, and use it to populate a drop-down
menu of
filenames. I show how to do it in both "Foundation PHP for
Dreamweaver
8" and "PHP Solutions", but it's not all that difficult to
code yourself
if you use scandir() (PHP 5 only).
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
Php Insert, Update & Delete error "invalid array length" CS5.5
Getting this error on both the wizard and the non-wizard options.
I have done all the requested "fixes" including:
deleting cache file
deleting .dws file
move "configuration" file and the regedit correction
unistalling and reinstalling
There are no extensions loaded.
I'm stumped. Lost my equipment in Hurricane Sandy and re-installed on new system running Win 7.
Any help would be apprecaited.Solution is silly - i upgraded Zend Framework to 1.9.3 patch 1 version.
In change log we can see:
* PHP 5.3 compatibility, including support for new features in the
mysqli extension. All components are fully tested on both PHP 5.2.x
and PHP 5.3.0.
Available since 23 sep - so just in time.
hsz -
PHP/mySQL Insert/Update Problems
I hope someone can help because I can't find anything online
that is helping me with this problem. I can't get the Dreamweaver
controls to work when coding a PHP insert or update record page. It
looks like it creates the code correctly but when I put them out on
my webserver and then fill out the form and click submit the page
submits and tries to use a URL string of (null)/admin/index.php
where index.php is the form page not the page I told it to redirect
to. I don't know why the (null) value keeps getting inserted into
the string either. The browser obviously can't find this URL so
gives a page cannot be displayed screen and nothing get's inserted
or updated in the mySQL database.
Any help would be greatly appreciated. This problem is
driving me crazy because I want to save time not having to hand
code things. Below is a User Authentication page using the
Dreamweaver controls that does the same thing when I try to
login.tobyd wrote:
> the page submits and tries to use a URL string of
(null)/admin/index.php
> where index.php is the form page not the page I told it
to redirect to. I don't
> know why the (null) value keeps getting inserted into
the string either.
The following two lines set the URL for login success and
failure.
> $MM_redirectLoginSuccess = "../admin_index.php";
> $MM_redirectLoginFailed = "../admin/index.php";
As you can see, they are relative paths, suggesting that the
login form
is in a different subfolder, but at the same level as
admin_index.php
and the admin folder. The (null) almost certainly comes from
the fact
that your login page is in the site root. If you're typing in
the
redirect filenames manually, use the Browse button instead.
Dreamweaver
should set the correct path for you.
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
How to create a dynamic newsflash using dreamweaver and PHP
Hi there,
I would like to create a dynamic newsflash using dreamweaver and PHP in that the newsflash will be pulling information from a MySQL database. The newsflash should also have a link to view more information about the piece of news a user wants to know more about. Which tools do I need to use in dreamweaver and how's the procedure to go about that. Any advice is highly appreciated. Thanx in advance!I think you´ll need at least a MySQL table with the following columns:
- id (primary key, int, auto_increment etc)
- news_headline (varchar)
- news_teaser (text)
- news_content (text)
What I´d personally add are columns such as:
- news_date (date or datetime)
- news_external_link (varchar), if a "read more..." link is supposed to navigate to an external URL rather than displaying the contens of the "news_contents" column.
Based on such a MySQL table it should be easy to use Dreamweavers standard Server Behaviors to create the usual datalist.php, insert.php, update.php and delete.php documents, and there are numerous tutorials out there which will teach you how to do that.
Am I right when assuming that you´ll also need to know how to automatically pull, say, the 5 most recent news records from the database ? -
Hi All:
I have a form that I using to upload my portfolio using the
php insert record function of Dreamweaver. How can I make it add
the date stamp using dreamweaver? Is the a piece of code some can
provide? My thought was add some kinda of hidden field and do
something with that. Any help would be appreciated..oO(cupaball)
>Great! Where does that go in all this Dreamweaver code?
>
> if ((isset($_POST["MM_insert"])) &&
($_POST["MM_insert"] == "portfolio")) {
> $insertSQL = sprintf("INSERT INTO port_tb (comp_name,
design_type, URL,
>short_des, long_des, thumbnail, medium_pic, large_pic,
long_pic) VALUES (%s,
>%s, %s, %s, %s, %s, %s, %s, %s)",
> GetSQLValueString($_POST['comp_name'], "text"),
> GetSQLValueString($_POST['design_type'], "text"),
> GetSQLValueString($_POST['URL'], "text"),
> GetSQLValueString($_POST['short_des'], "text"),
> GetSQLValueString($_POST['long_des'], "text"),
> GetSQLValueString($_POST['thumbnail'], "text"),
> GetSQLValueString($_POST['medium_pic'], "text"),
> GetSQLValueString($_POST['large_pic'], "text"),
> GetSQLValueString($_POST['long_pic'], "text"));
Where do you want the date to go? The date column has to be
listed
inside of the parentheses after "INSERT INTO port_tb", the
NOW() call
inside the VALUES parentheses at the same position. Here's an
example
with the date at the first position (adjust the name as
necessary):
$insertSQL = sprintf("INSERT INTO port_tb (dateField,
comp_name,
design_type, URL, short_des, long_des, thumbnail,
medium_pic,
large_pic, long_pic) VALUES (NOW(), %s, %s, %s, %s, %s, %s,
%s, %s,
%s)",
... // all the rest
Micha -
PHP 5.1.4 for Apache 2
Not Sure if this is the correct forum for this but here goes...
G5 10.4.6
PHP 5.1.4 for Apache 2
I've installed it but i'll be damned if I can get it to run. My Apache runs ok. Anyone have a clue? Do I need to insert code into Terminal to get it to run?
Any help will be greatly appreciatedThe PHP is installed and working But! only if I type in the url of the php page.ie. http://127.0.0.1/~usr/local/test.php
Inserting info into the HTML form pointing to a .php page still justs shows the code on the .php doc, -
Generally Dreamweaver provides good support for changes to
templates, and
automatically updates all the files using a particular
template when you change
that template. However this breaks down if you change a
template, or a file, to
.php. Dreamweaver regards this as creating a new file, and
does not offer to
update links.
My master template was basicpage.dwt. I created a new dynamic
page, copied the
guts of basicpage.dwt into it, and then saved it as basic
page.dwt.php.
I didn't really expect Dreamweaver to recognise that this was
replacing
basicpage.dwt, but when I opened the template directory I was
surprised to find
that it did not show the extensions, just two files
basicpage. So I renamed
basicpage.dwt.php to basicphpage.dwt.php so I could tell them
apart. Then I
opened index.htm, attached it to basicphpage.dwt.php,
inserted some php to
verify that it worked and resaved it as index.php. I uploaded
to my file server
and verified that the php worked. I also found that my host
system loaded
index.php by default.
Next I opened one of the existing subsidiary templates,
attached it to
basicphpage.dwt.php, and resaved it. Dreamweaver saved it
with the correct
extension, but again did not recognise that I had changed the
template.
Next I opened one of the dependent files, attached it to the
new template, and
resaved it. Again Dreamweaver regarded this as creating a new
file, and did not
offer to update links. So when I convert each template I will
then have to open
every existing page using it, manually attach the new version
of the template to
it, and manually update all the links in it, or referring to
it. Drat!
It looks as if I should only convert those pages which I want
to be dynamic, and
only do so when I am ready to add the new functionality.
ClancyYeah. Clancy only wants to hear his truth....
No offense, Clancy, but my dogma beats your dogma.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"(_seb_)" <[email protected]> wrote in message
news:[email protected]...
> sorry for the dogma. I'll stop
>
> (_seb_) wrote:
>> I sure do get your point. learning all that stuff is
rather boring in
>> itself. That's what I've told myself for years,
until I dived into PHP
>> (with a book at first, but now I just go to
>>
http://us3.php.net/manual/en/)
whenever I need to learn something new.
>>
>> Once I did, and once I managed to setup a local
testing server on my
>> machine, I was surprised at how easy it was to learn
the basic stuff that
>> allows content architecture management. It took me
about two weeks to
>> learn the most useful techniques (how to generate
html code with php, how
>> to include remote files, how to use arrays, how to
use conditionals).
>>
>> Now that I know that, I enjoy building websites much
more, and I can do
>> it much faster. For one thing, you say you have 'a
total of 300 to 400
>> pages'. That's a problem with static sites. Pages
number has become an
>> irrelevant concept since I use PHP. My sites rarely
have more than 10
>> 'pages', even if the visitor can navigate through
vast ammounts of
>> content. Because PHP templates allow me to generate
pages on the fly,
>> depending on what content needs to be displayed, so
I can add content
>> without having to build new pages... That's a lot of
fun to build sites
>> that way. I also can offer much more to my clients
in terms of
>> flexibility and content management, which allows me
to charge them
>> more... Website maintenance is a breeze. If I had
known what
>> possibilities it would open and how it would
optimize my workflow, I
>> wouldn't have waited so long to dive into it.
>>
>> But of course there is a time for everything. I just
couldn't recommend
>> anything more than learning a server-side language,
to anybody who wants
>> to make a living of webdesign (and have fun doing
it).
>>
>> Clancy wrote:
>>
>>> "(_seb_)" <[email protected]> wrote:
>>>
>>>
>>>> if you use PHP I don't see why you would use
Dreamweaver templates.
>>>> You can do with PHP more, better, and fatser
in terms of content
>>>> architecture (i.e. really functional
templates) than what DM templates
>>>> can do. AND, your dynamic PHP templates
won't be dependent on
>>>> Dreamweaver's UI.
>>>
>>>
>>>
>>> I have been working on my several web sites for
about four years now,
>>> and
>>> probably have a total of 300 to 400 pages. These
work, I think they
>>> look
>>> attractive, and user feedback has been
favorable. If I had nothing
>>> better to do, I could probably spend a year or
so working out
>>> how to do the same job without using templates.
The resulting new
>>> design MIGHT
>>> be significantly easier to modify, and perhaps
even to maintain, but the
>>> new
>>> pages would probably look much the same (I like
the way they look now!),
>>> and I
>>> very much doubt if the visitor would notice the
difference.
>>> I can see that there are a number of minor
improvements I will be able
>>> to make
>>> to my sites, once I have mastered php and mysql,
but the one major
>>> incentive I
>>> have for learning them is that I have a number
of photo albums, and it
>>> will be
>>> much easier to add new photos once I have set up
a database. I have
>>> already passed my biblical 'use by' date, and I
don't feel that I have a
>>> year to throw away just to make my web sites
comply with someone else's
>>> dogma.
>>> I have a lot more material I would like to add
to my various web sites,
>>> and I
>>> feel that this would be a much more profitable
use of my remaining time,
>>> to say
>>> nothing of it being much more fun.
>>>
>>>
>>> Clancy
>>
>>
>>
>
>
> --
> seb ( [email protected])
>
http://webtrans1.com | high-end web
design
> Downloads: Slide Show, Directory Browser, Mailing List -
I'm trying to implement the new ActiveX detection that MM put
out and am having trouble getting it to work correctly ( at all )
Would having a PHP page versus the HTML that is documented
make any difference? I'd think it wouldn't
HelpHey Rezun8 - I never use the Flash published HTML either. I
just insert the swf files into my html pages in Dreamweaver. When I
do this the swf creates its own object embed tags with all the
parameters. Then in Dreamweaver I can also add parameters to the
swf file.
I am not a PHP guy at ALL, but I use a PHP commerce store
called OSCommerce and I manipulate the php around a little to
customize the store. There is a part in the php page where I can
add an image or flash object but the php inserts it. Here is the
code from the PHP page, but I can not figure where to put the call
for the js and where to put the script? The part where the flash
object is inserted is at the bottom of the code example.
I am using the Adobe js code fix.
By the way, in your page sample it still has the dreaded box,
is that file already done? -
Php input date/time as timestamp with timezone
This is a nightmare!!!!
I have numerous databases, all of which use timestamp format
date/times, which are easy to echo according to user timezone
preferences using putenv ("TZ=".$_SESSION['MM_UTZ']); and echo
date($_SESSION['MM_UTF'], ($whatever));
The only problem is, I have only used these for stamping
"date created" or "date edited" values using Time()
What I am trying to achieve is:
User 1 in UK enters date and time, using a javascript
datetime picker (which normally enters data into field in Y-m-d
H:i:s) and the php inserts this in timestamp format according to
timezone.
User 2 in US looks at date and time and this is echo'd
according to his timezone.
Sounds simple...
I have managed to get so far with the new DateTime object
which incorporates the user timezone preference ($utz)
$ndttime= new DateTime($timefield, new DateTimeZone($utz));
I can then echo this effectively using
echo $ndttime->format('$utf'); ($utf being user timeformat
preference)
My stupid problem is trying to get the $ndtime into the
database!!!!
I know this sounds ridiculous but I use the DW insert wizard
which only uses values from a form and if I echo $ndtime into a
hidden field, it doesn't process this value in time.
I attach the current insert script.
Is this simple?
Heeeeelp.quote:
Originally posted by:
AXEmonster
how does this format when you echo to the page
echo $ndttime->format('$utf');
This will echo as a date/time object - i.e. Y-m-d H:i:s, but
the $utf variable is a session variable with user time format
preferences, so it could be D, d/m/Y H:i:s or m-d-Y H:i:s
etc. -
Can i enter php code into html snippets?
I am an sql/php newbie ... and have my site hosted by a company which offers me sql and php hosting (unlike dotmac I understand) ...
I have created an sql database on their server and have written a page in html/php to display the results of a simple search ... can I insert this into iweb page using snippet - as I have tried and get a page cannot be displayed message where the snippet box would be on the webpage. (you can see this by clicking on the guestbook link on www.antandcleopuss.com)
I am wondering if iweb can insert php or if it is only html?
If iweb doesn't like php inserts then I will have to export my pages to a folder, then open them in a text editor to insert the php there?? (seems like an awfully long way round)
Any help gratefully received
antYou can add PHP code AFTER publishing the webpage.
Then change the extension to .php.
Here's a page the explains how to do it. It's not PHP specific but the routine is the same.
http://web.mac.com/wyodor/Ajax/
Of course you can add a PHP page to the HTML Snippet with an iframe.
Maybe you are looking for
-
Creating a new document using XQuery
Hello everyone, I wondered if there was a way to create a new document using XQuery. What I am trying to do is to run a query on XML file and try to print the results in HTML for viewing purpose. The HTML is spitted out on DOS prompt. Instead I wante
-
MacBook Pro 13` 10.6.2+ keyboard problem
I got my MacBook Pro last week, with 10.6 installed... yesterday I decided to upgrade to 10.6.4 to be able to use facetime... but, after installing the update, the keys 0, 2, w, s, x started to act strange, sometine not working, and sometime working
-
How to use FILTER -- USING in rpd???
Can we use FILTER USING in rpd ?
-
Question about Upgrade to 3.1.2
Hi Guys, First off all, I installed Oracle XE 10g (so apex 2.1), on Windows XP 32 bits. I can connect to the XE database perfectly. I can naviguate in it just fine. I added that XE instance into my 10g client and I can administer it from there, no pr
-
What are the consequenses of the iPhone 4 dropping 3 feet to the ground?
Today I was texting, and when I got done I put my iPhone 4 inside my sweaters pocket. But it accidentally fell to the ground as I was walking. I would like to know what are the consequences of the iPhone 4 dropping 3 feet to the ground. Will it be sl