hamza
-
Posts
321 -
Joined
-
Last visited
Posts posted by hamza
-
-
i am selecting user from drop down list and after selecting form submit.
and user id submited .on the bases of user_id i need to show user right on
all module.
how i can do that using one query.
my schema
========
CREATE TABLE `tblactions` ( `action_id` int(11) NOT NULL auto_increment, `actions` varchar(255) default NULL, PRIMARY KEY (`action_id`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; CREATE TABLE `tblmoduleactions` ( `moduleaction_id` int(10) NOT NULL auto_increment, `module_id` int(10) default NULL, `action_id` int(10) default NULL, PRIMARY KEY (`moduleaction_id`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; CREATE TABLE `tblmodules` ( `module_id` int(10) NOT NULL auto_increment, `module_name` varchar(255) default NULL, PRIMARY KEY (`module_id`) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; CREATE TABLE `tbluserrights` ( `userrights_id` int(10) NOT NULL auto_increment, `user_id` int(10) default NULL, `moduleaction_id` int(10) default NULL, PRIMARY KEY (`userrights_id`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; INSERT INTO `tblactions` VALUES ('1', 'Add'); INSERT INTO `tblactions` VALUES ('2', 'Update'); INSERT INTO `tblactions` VALUES ('3', 'Delete'); INSERT INTO `tblactions` VALUES ('4', 'List'); INSERT INTO `tblmodules` VALUES ('1', 'Manage Category'); INSERT INTO `tblmodules` VALUES ('2', 'Manage Products'); INSERT INTO `tblmodules` VALUES ('3', 'Manage Users'); INSERT INTO `tblmodules` VALUES ('4', 'Manage Manufacture'); INSERT INTO `tbluserrights` VALUES ('1', '11', '1'); INSERT INTO `tbluserrights` VALUES ('2', '12', '2'); INSERT INTO `tblmoduleactions` VALUES ('1', '1', '1'); INSERT INTO `tblmoduleactions` VALUES ('2', '2', '1'); INSERT INTO `tblmoduleactions` VALUES ('3', null, null);
-
i want to embed flv video
<object width="550" height="400">
<param name="movie" value="myvideo.flv">
<embed src="myvideo.flv" width="550" height="400">
</embed>
</object>
-
i want to strip span tag as well as anchor tag
this code is in my php post array
<br><br><span id="1.612802118875386"><b>Other Page: </b>Matte Card<br><b>Gramage: </b>80 gram<br>sdafsdaf<br> <a href="#" onclick="removetext(1.612802118875386)"> Remove </a> </span><br><br><span id="1.014127052347593"><b>Other Page: </b>Matte Card<br><b>Gramage: </b>100 gram<br>sdfasfsdfdsfsdafsdafas<br> <a href="#" onclick="removetext(1.014127052347593)"> Remove </a> </span>
strip tag funtion is not workign for me.
-
I Want to study zend framework
i am not getting on this link
http://framework.zend.com/download/latest
there are so many for download which one is for beginner
and i need exactly dir structur
/application
/modules # modules directory
/default # directory of the module named 'default'
/contollers
like that
kindly guide me about that and give me exact link to direectly download the
Zend framework...with guide
thanks
-
$string = array('1_1','1_2','2_3');
$str2arr = explode('_', $string);
using this concept how i use explode
-
1_1
1_2
3_5
i have this is in $_POST array
i want to separate this string by using _ separate.
kindly separate the values 1 and 1 from 1_1
or same as like that.others
thanks
-
i wanted to show structur in select option tag.
more then 1 level i wnated to show in drop down list .
please tell me how it is possible to show.
category and subcategory structure
========================
category
|_subcat-1
|_subcat-1
|_subcat-1
|_subcat-1
|_subcat-1
Categroy2
|_subcat-1
|_subcat-1
|_subcat-1
-
I can't tell whether your AJAX will work or not, but your PHP page won't do what you want.
Remember to test your PHP pages themselves before calling them with AJAX, so that you can debug them easier. For example, you could easily go to http://localhost/p.php?action=add&name=Dan
That would make sure that the script is going to work, which I bet it doesn't. The reason? You seem to have echo statements dotted around everywhere. You only use echo if you want to output something, you have it on your first line where it isn't needed (you're also missing a semi-colon at the end of this line). Change your code to this and see whether it works:
<?php $action = $_GET['action']; switch ($action) { case 'add': add(); default: } function add() { $link = mysql_connect('locahost','root','root'); mysql_select_db('test'); $sql = " INSERT INTO 'user'(name) VALUES('". $_GET['name'] ."') "; mysql_query($sql, $link); echo '1'; } ?>
Remember: check the page on its own first rather than calling it via AJAX, that way you will get any errors that PHP produces.
thanks for yoru attention
i checked the php page without ajax ...... its working then
but when i apply ajax then its not working with ajax
i menually tries it with yoru suggestion give a dummy name in url but
nothing happening........
-
i have ajax page on which i have created a simple one field form which
contain name filed.which is going to insert in database.
and query is rouuning on p.php
you can see p page below
this problem is when form values are not going to p.php page.
and i am passed p.php as a parameter in onsubmit even present in
form tag.
please tell me why this is not running as expected and
any better way to improve to write this problem solution
thanks
p.php
<?php echo $action = $_GET['action'] switch ($action) { case 'add': add(); default: } function add() { $link = mysql_connect('locahost','root','root'); mysql_select_db('test'); echo $sql = " INSERT INTO 'user'(name) VALUES('". $_GET['name'] ."') "; mysql_query($sql); echo '1'; } ?>
ajax.php
<script type="text/javascript"> function loadXMLDoc(url) { req = false; // branch for native XMLHttpRequest object if(window.XMLHttpRequest && !(window.ActiveXObject)) { try { req = new XMLHttpRequest(); } catch(e) { req = false; } // branch for IE/Windows ActiveX version } else if(window.ActiveXObject) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { req = false; } } } if(req) { alert(url); req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send(""); } } function processReqChange() { // only if req shows "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { div_msg.innerHtml = req.responcetext; // ...processing statements go here... } else { alert("There was a problem retrieving the XML data:\n" + req.statusText); } } } </script> <div id="div_msg"></div> <form method="GET" onsubmit="loadXMLDoc('p.php')"> <input type="text" name="name"> <input type="hidden" name="action" value="add"> <input type="submit"> </form>
-
yeah desc is a reserv word try to change it ...descr or description.
-
kindly help me out
-
what is Crystal reports in php?
There is no such extension.
i wanted to know about crystal reports
-
-- ---------------------------- -- Table structure for articals -- ---------------------------- CREATE TABLE `articals` ( `artical_id` int(11) NOT NULL auto_increment, `cat_id` int(11) default NULL, `title` varchar(255) default NULL, `dateandtime` datetime default NULL, `img` varchar(255) default NULL, `description` text, `tags` varchar(255) default NULL, PRIMARY KEY (`artical_id`) ) ENGINE=MyISAM AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; catagory table - ---------------------------- -- Table structure for categories -- ---------------------------- CREATE TABLE `categories` ( `cat_id` int(11) NOT NULL auto_increment, `cat_name` varchar(255) default NULL, PRIMARY KEY (`cat_id`) ) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
problem :
when i del catagory from catagory table then evey artical have catagory field.
but if i del a catagory which is present in artical table then.
it soud ugly or what should i do del the artical when del the catagory.
kindly guide me and see the data schema.
-
I'm trying out the code below. I'm able to connect to the database. To make sure I have entered my values into my database I have set up a test to look for errors. I assign the query to $results and then have PHP tell me whether or not it worked. Unfortunately, I keep getting the message...
"An error has occurred. The item was not added."
Thanks for the help.
------------Code-------------
<?php
$npn_email=$_POST['npn_email'];
$purchase_email=$_POST['purchase_email'];
$zip=$_POST['zip'];
date_default_timezone_set('Canada/Atlantic');
$current_date='';
$current_date = date('Y-m-d H:i:s');
if (!$npn_email) {
if (!get_magic_quotes_gpc()) {
$purchase_email = addslashes($purchase_email);
$zip = addslashes($zip);
$current_date = addslashes($current_date);
}
@ $db = new mysqli('XXXXXXXX', 'XXXXXXXX', 'XXXXXXXX', 'XXXXXXXX');
if (mysqli_connect_errno()) {
echo "Error: Could not connect to database. Please try again later.";
exit;
}
$query = "insert into orders (email, zip, current_date) values ('$purchase_email', '$zip', '$current_date')";
$result = $db->query($query);
if ($result) {
echo "Thank you for your purchase! You have been entered to win!";
} else {
echo "An error has occurred. The item was not added.";
}
$db->close();
}
else {
echo"You hit the NPN button";
}
?>
dumping code is not good idea.
show what you are getting in error...
-
what is Crystal reports in php?
why
how
we can use them??
-
zend studio 5.5 is the best one to code in php.
-
If you want the search to be case insenstiive then yes, you would use strtolower on the check and the insert
if(!in_array(strtolower($checktag),$unique_tags)) { $unique_tags[] = strtolower($checktag); }
thanks for the help.
-
What is not working?
Are you getting errors, or just not what you expected?
no no now its working fine there is a syntax error there now solved
but one thing you are missing in there n that is case sensitive.
i am getting two php tags liek PHP and php.
now i think while insertion i should make it strtolower.
-
function get_all_tags($db) { //cat array contain catagory names and id $tag = array(); $unique_tags = array(); //getting all catagories from database. $result = $db->query("SELECT tags FROM `articals`", $debug = -1); while($row = $db->fetchNextObject($result)) { if ( !empty($row->tags) ) { $tag = explode(',',$row->tags); foreach($tag as $checktag) { if(!in_array($checktag,$unique_tags)) { $unique_tags[] = $checktag; } } } } //making unique array of //print '<pre>'; //print_r($tag); //$tag = array_unique($tag); //print_r($tag); return $unique_tags; }
any alternative way to fetch tags from database with unique list.
this code is not working.
-
i have tags field in my table and tags field is optional when tags are addes
so most of the time tag field is empty with no tag.
and some time there are so many tags in a tag field of database.
like in my artical table i have tags field which contain
php, frameworks , advance php
empty field
java
jquery
how i can fetch all tags to show on user side and ignore empty field.
and should be unique tags in the list.
my fetch funtion is show as
/** getting all tags */ function get_all_tags($db) { //cat array contain catagory names and id $tag = array(); //getting all catagories from database. $result = $db->query("SELECT tags FROM `articals`", $debug = -1); while($row = $db->fetchNextObject($result)) { if ( !empty($row->tags) ) { explode(',',$row->tags); $tag[] = $row->tags; } } //making unique array of print '<pre>'; print_r($tag); $tag = array_unique($tag); print_r($tag); return $tag; }
-
You can put the ad in an i-frame and refresh the i-frame or use AJAX and put the ad in a DIV and re-generate it using that. If the AJAX way, look into jQuery.
i-frames are not very friend when we talk about browsers.
so i suggest use ajax
-
Hello,
I'm getting the following error message:
Fatal error: Call to undefined function timestamp() in xxxxxxxxxx on line 6
When I look at line 6, it's:
$fletch = date ("Ymd");
There's no MySQL involved in this code, it's just PHP. For some reason it won't recognize today (current)'s date, but it recognizes anything backdated.
make something like that
$fletch = date ("Ymd",time());
or if u r fetching from database then fetching field be something lke that
$db_firld = strtotime('your db field');
$fletch = date ("Ymd",$db_firld);
-
The .htaccess should be placed in the document root for the website.
Your apache configuration should allow .htaccess override.
i.e.
AccessFileName .htaccess <Directory "/var/www/html"> AllowOverride All </Directory>
by default allowing is enable or not for .htaccess file.
can we enable it in php.ini
or
if i have many .htaccess files then evy time i have to
allow it by using tags u shown above.
-
the problem with this structure is, what if you want to suddenly associate a product with five sections? you'd have to add a column, and if the database is designed properly, you should never need to change the structure itself after starting to use it.
very interesting example ..............
do u have more example reading for more better understanding.
I'd agree with this. It might make sense to limit this client to four levels, and build the database accordingly... but if possible I'd rather build something more generic. Another trick up my sleeve that I can pull out of my hat if I need it again.
akitchin: that article is SWEET! The only problem I'm seeing with the Nested Set model is in ordering the nodes. The structure is so dependent on the nodes' placement relative to each other that it seems like it would be difficult to alphabetize the list by name or price, for example.
I've also found this: http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html
Am reading it now, so not sure if it applies, but it looks promising....
string separation
in PHP Coding Help
Posted
thanks