PHP和MYSQL问题 [英] PHP and MYSQL Problem

查看:81
本文介绍了PHP和MYSQL问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用这一行代码从数据库中选择用户ID,但是我无法选择它.我不知道为什么,因为浏览器没有显示任何错误,而且我无法弄清楚问题出在哪里.请帮我;对不起,此代码中使用的语言是因为它是阿尔巴尼亚语(我在我的国家/地区使用的语言)

I am using this small line to select user id from my database , but I can''t select it . I don''t know why , because the browser doesn''t display any error , and I cannot figure where the problem is. Please help me; Excuse me for the language used In this code , because it is Albanian language (the language I use in my country)

<html>
<head>
<title>Krijo nje artikull per kete faqe</title>
<link rel="stylesheet" href="assets/login_form/reset.css">
<link rel="stylesheet" href="assets/login_form/animate.css">
<link rel="stylesheet" href="assets/login_form/styles.css">
<script type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
        // General options
        mode : "textareas",
        theme : "advanced",
        plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

        // Theme options
        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,

        // Skin options
        skin : "o2k7",
        skin_variant : "silver",

        // Example content CSS (should be your site CSS)
        content_css : "css/example.css",

        // Drop lists for link/image/media/template dialogs
        template_external_list_url : "js/template_list.js",
        external_link_list_url : "js/link_list.js",
        external_image_list_url : "js/image_list.js",
        media_external_list_url : "js/media_list.js",});
</script>
</head>
<body>
<?php

mysql_connect("localhost","login_h","1234");
mysql_select_db("articles");
	if(!isset($_COOKIE['zakamezusr'])){
			header("Location: login.php");
	}
		if(isset($_POST['submit'])){
			$author_id = mysql_query("SELECT ID FROM users WHERE username ='".stripslashes($_COOKIE['zakamezusr'])."'");
			$query = "INSERT into posts (title , post ,date_up , author_id , description) VALUES ('".$_POST['title']."', '".$_POST['post']."', '".$_POST['date_up']."', '$author_id', '".$_POST['description']."')";
			mysql_query($query);
?>
<h1>sfafdadfasdfasd</h1>
<?php
}else{
?>
<div id="container" style="removed20%;removed:relative;width:640px;">
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
	
 <h1>Krijo nje Artikull te ri</h1>
 <table border="0">

 <tr><td>Emri i Artikullit</td><td>

 <input type="text" name="title" maxlength="60">

 </td></tr>
 
 <tr><td>Pershkrimi i Artikuallit</td><td>

 <input type="text" name="description" maxlength="60">

 </td></tr>

 
 <tr><td>Teksti</td><td>

 <textarea class="mult" name="post" ></textarea>
 </td></tr>
 <tr><th colspan=2><input type="submit" name="submit" 

value="Register">
</th></tr> </table>
</form>

</div>

<?php
}
?>

</body>
</html>

推荐答案

_COOKIE [' zakamezusr' span>])){ 标头(" ); } if(isset(
_COOKIE['zakamezusr'])){ header("Location: login.php"); } if(isset(


_POST [' 提交']) ){
_POST['submit'])){


author_id = mysql_query(" .stripslashes(
author_id = mysql_query("SELECT ID FROM users WHERE username ='".stripslashes(


这篇关于PHP和MYSQL问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆